List of usage examples for java.lang String replace
public String replace(CharSequence target, CharSequence replacement)
From source file:Main.java
public static String formatPhoneNum(String phoneNum) { if (TextUtils.isEmpty(phoneNum)) { return null; }// w w w. j a v a2 s .c om return phoneNum.replace(" ", ""); }
From source file:Main.java
public static String addStuff(String text) { if (text == null) { text = "<blank>"; }/* w w w .j a v a2 s . c o m*/ text = text.replace(QUOTE, "'"); return QUOTE + text.trim() + QUOTE + ","; }
From source file:Main.java
public static String formatPhone(String phone) { if (!checkString(phone)) { return phone; }/*from w w w. ja v a 2 s.c om*/ phone = phone.replace("-", ""); phone = phone.replace(" ", ""); return phone; }
From source file:Main.java
public static Date formatDateDayFirst(String date) { try {/*from w ww . ja v a2 s. c o m*/ return new SimpleDateFormat("dd-MM-yyyy", Locale.getDefault()).parse(date.replace("/", "-")); } catch (Exception e) { return null; } }
From source file:fi.aluesarjat.prototype.guice.ModuleUtils.java
private static RDFSource transform(RDFSource source, String baseURI) { try {//from w ww. jav a2 s. c o m String encoding = source.getFormat().equals(Format.NTRIPLES) ? "US-ASCII" : "UTF-8"; String str = IOUtils.toString(source.openStream(), encoding); String normalized = str.replace(DEFAULT_BASE_URI, baseURI); return new RDFSource(new ByteArrayInputStream(normalized.getBytes(encoding)), source.getFormat(), source.getContext()); } catch (IOException e) { throw new RepositoryException(e); } }
From source file:jQuery.PRIMO.Record.java
/** * Get record id./*from w w w .j av a2 s .c om*/ * * @param data blob of data * @return the record id */ public static String getRecordID(String data) { return data.replace("." + getRecordExt(data), ""); }
From source file:Main.java
public static boolean isMacEqual(String mac1, String mac2) { if (!TextUtils.isEmpty(mac1) && !TextUtils.isEmpty(mac2)) { return mac1.replace(":", "").toUpperCase().equals(mac2.replace(":", "").toUpperCase()); }/* w w w. j ava 2s .co m*/ return false; }
From source file:Main.java
private static String updateFormat(String dateTime) { if (dateTime.indexOf('y') == dateTime.lastIndexOf('y')) { dateTime = dateTime.replace("y", "yyyy"); }//from w ww.j av a2s. c o m return dateTime; }
From source file:Main.java
public static String getFunctionFromReturnUrl(String url) { Log.e(TAG, "getFunctionFromReturnUrl url=>" + url); String temp = url.replace(PANDO_RETURN_DATA, EMPTY_STR); String[] fuctionAndData = temp.split(SPLIT_MARK); if (fuctionAndData != null && fuctionAndData.length >= 1) { return fuctionAndData[0]; }/*from ww w . j av a 2 s .com*/ return null; }
From source file:Main.java
/** * Parse a URL query and fragment parameters into a key-value bundle. *///from ww w . j a va2 s. c om public static Bundle parseUrl(String url) { // hack to prevent MalformedURLException url = url.replace("weiboconnect", "http"); try { URL u = new URL(url); Bundle b = decodeUrl(u.getQuery()); b.putAll(decodeUrl(u.getRef())); return b; } catch (MalformedURLException e) { return new Bundle(); } }