List of usage examples for java.lang String replace
public String replace(CharSequence target, CharSequence replacement)
From source file:Main.java
public static String formatMobileNum(String str, int start, int end) { String subString = str.substring(start, end); return str.replace(subString, "****"); }
From source file:Main.java
/** * Check new version//from w ww .j a v a2s .c o m * @param strOldVer * @param strNewVer * @return */ public static boolean checkVersion(String strOldVer, String strNewVer) { strOldVer = strOldVer.replace('.', ','); strNewVer = strNewVer.replace('.', ','); String[] oldVers = strOldVer != null ? strOldVer.split(",") : null; String[] newVers = strNewVer != null ? strNewVer.split(",") : null; final int VERS_LENGTH = 3; if (oldVers != null && oldVers.length == VERS_LENGTH && newVers != null && newVers.length == VERS_LENGTH) { try { for (int i = 0; i < VERS_LENGTH; i++) { int over = Integer.parseInt(oldVers[i]); int nver = Integer.parseInt(newVers[i]); if (nver > over) { return true; } else if (nver < over) { return false; } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } return false; }
From source file:at.gv.egovernment.moa.id.auth.builder.RedirectFormBuilder.java
public static String buildLoginForm(String url, String redirectTarget) { String value = getTemplate(); value = value.replace(URL, url); value = value.replace(TARGET, redirectTarget); return value; }
From source file:com.livinglogic.ul4.BoundStringMethodReplace.java
public static String call(String object, String search, String replace) { return object.replace(search, replace); }
From source file:Main.java
public static String getUsernameFromAddress(String address) { if (address.contains("sip:")) address = address.replace("sip:", ""); if (address.contains("@")) address = address.split("@")[0]; return address; }
From source file:Main.java
public static double DecimalToDouble(String dec) { //replace all commas with periods String commaReplaced = dec.replace(',', '.'); return Double.parseDouble(commaReplaced); }
From source file:Main.java
/** * ses format "yyyy-MM-dd:hh'h'mm'm'ss's'SSS'Z'" * @param date/*from w ww. j av a 2s.c o m*/ * @return */ public static Calendar getCalendarFromNice(String date) { date = date.replace("h", ""); date = date.replace("m", ""); date = date.replace("s", "."); date = date.replace(":", ""); date = date.replace("-", ""); return getCalendar(date, null); }
From source file:Main.java
public static boolean containsOnly(String stringToMatch, String... candidates) { String left = stringToMatch; for (final String candidate : candidates) { left = left.replace(candidate, ""); }/*w w w . j a v a2 s.c o m*/ return left.isEmpty(); }
From source file:com.hubrick.raml.mojo.util.JavaNames.java
public static String toFilePathString(String className) { return className.replace('.', File.separatorChar) + ".java"; }
From source file:Main.java
public static String clazzName(final File base, final File file) { final int rootLength = base.getAbsolutePath().length(); final String absFileName = file.getAbsolutePath(); final int p = absFileName.lastIndexOf('.'); final String relFileName = absFileName.substring(rootLength + 1, p); return relFileName.replace(File.separatorChar, '.'); }