List of usage examples for java.lang String replace
public String replace(CharSequence target, CharSequence replacement)
From source file:Main.java
static private String getRelName(String from, File file) { String a = file.getAbsolutePath().replace(from + "\\", ""); a = a.replace("\\", "/"); return a;/*from ww w .ja v a2 s . c o m*/ }
From source file:Main.java
/** * Hex to color.//w ww . ja va 2s . com * * @param colorHex * the color hex * @return the color */ public static Color hexToColor(String colorHex) { final String replace = colorHex.replace("#", "0x"); // System.out.println(replace); return Color.decode(replace); }
From source file:com.turqmelon.MelonDamageLib.utils.EntityUtil.java
public static String getEntityName(Entity entity) { if (entity.getCustomName() != null) { return entity.getCustomName(); } else {//from ww w . j a v a 2 s .c o m String name = entity.getType().name(); name = name.replace("_", " "); return WordUtils.capitalizeFully(name); } }
From source file:desi.juan.internal.util.MethodGeneratorUtils.java
public static String uriToCammelCase(String uri) { uri = uri.replace("{", "/").replace("}", "/"); StringBuilder result = new StringBuilder(); for (String word : StringUtils.split(uri, "/")) { if (word.contains("_")) { word = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, word); }//from www . j av a 2s .c o m result.append(StringUtils.capitalize(word)); } return StringUtils.uncapitalize(result.toString()); }
From source file:Main.java
public static Bundle parseUrl(String url) { url = url.replace("rrconnect", "http"); try {/*w w w . j a v a2 s . c om*/ URL u = new URL(url); Bundle b = decodeUrl(u.getQuery()); b.putAll(decodeUrl(u.getRef())); return b; } catch (MalformedURLException e) { return new Bundle(); } }
From source file:Main.java
public static Bitmap LoadImageFromWeb(String url) { try {//from ww w .ja v a 2 s . co m String encodedurl = url.replace(" ", "%20"); InputStream is = (InputStream) new URL(encodedurl).getContent(); Bitmap d = BitmapFactory.decodeStream(is); return d; } catch (Exception e) { e.printStackTrace(); return null; } }
From source file:Main.java
public static String escapeXML(String xml) { // TODO: this is incorrect and inefficient return xml.replace("<", "<").replace(">", ">").replace("&", "&"); }
From source file:Main.java
public static String getFormatedMac(String mac1) { if (!TextUtils.isEmpty(mac1)) { return mac1.replace(":", "").toUpperCase(); }/*from w w w. ja va 2 s. c o m*/ return ""; }
From source file:Main.java
public static String getMappingLocales(String locale) { return PROPERTIES.getProperty(locale, locale.replace("-", "_")); }
From source file:Main.java
/** * <b>Do not use outside of CDT.</b> This method is a workaround for {@link javax.xml.transform.Transformer} * not being able to specify the line separator. This method replaces a string generated by * {@link javax.xml.transform.Transformer} which contains the system line.separator with the line separators * from an existing file or the preferences if it's a new file. * * @param string - the string to be replaced * @param lineSeparator - line separator to be used in the string * /*from w w w. jav a2 s. c om*/ * @noreference This method is not intended to be referenced by clients. * This is an internal method which ideally should be made private. */ public static String replaceLineSeparatorInternal(String string, String lineSeparator) { string = string.replace(LINE_SEPARATOR, lineSeparator); return string; }