List of usage examples for java.lang String replaceAll
public String replaceAll(String regex, String replacement)
From source file:Main.java
public static String getHtmlStrCnvr(String srcString) { String tmpString = srcString; tmpString = tmpString.replaceAll("<", "<"); tmpString = tmpString.replaceAll(">", ">"); tmpString = tmpString.replaceAll("&", "&"); tmpString = tmpString.replaceAll(" ", " "); tmpString = tmpString.replaceAll("'", "\'"); tmpString = tmpString.replaceAll(""", "\""); return tmpString; }
From source file:Main.java
public static String cleanFromXML(String cleanMe) { if (cleanMe != null) { cleanMe = cleanMe.replaceAll("&", "&"); cleanMe = cleanMe.replaceAll("<", "<"); cleanMe = cleanMe.replaceAll(">", ">"); cleanMe = cleanMe.replaceAll(""", "\""); return cleanMe; }//from www . jav a2 s . co m return ""; }
From source file:Main.java
public static Bitmap GetFromFile(String fileName, String path) { String fString = fileName.replaceAll("/", "."); File file = new File("/sdcard/OneBus/user/" + path + "/" + fString + ".jpg"); if (!file.exists()) { return null; }/*from w ww .j av a 2s .c o m*/ try { FileInputStream fis = new FileInputStream(file); return BitmapFactory.decodeStream(fis); } catch (FileNotFoundException e) { e.printStackTrace(); return null; } }
From source file:Main.java
public static boolean isMucNickNameLegal(String nickName) { nickName = nickName.trim();// w ww .j a v a 2s . c o m String name = nickName.replaceAll("[^a-zA-Z0-9_@~!,\\[\\]\\-=+#\'\";?()!*\\s]", "**"); int len = name.length(); if (len == 0 || (len >= 2 && len <= 20)) { return true; } return false; }
From source file:com.berniesanders.fieldthebern.parsing.FormValidator.java
private static boolean passesPhoneRequirements(String number) { number = number.replaceAll("[^\\d]", ""); if (number.length() < 10) { return false; } else if (number.startsWith("0")) { return false; }//from w ww . j a v a 2s . c om return true; }
From source file:Main.java
static public byte[] toByteArray(String hexDumpString) { return DatatypeConverter.parseHexBinary(hexDumpString.replaceAll(" ", "")); }
From source file:Main.java
public static String convertValueQueryToRegex(String value) { return value.replaceAll("\\*", ".*?"); }
From source file:Main.java
public static String escape(String s) { if (s == null) { return s; }//w w w . ja v a 2s. c o m return s.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("'", "'") .replaceAll("\"", """); }
From source file:Main.java
public static String getMiddleAvatar(String source) { if (source == null) return null; return source.replaceAll(AVATAR_SIZE_REG, MIDDLE_SIZE); }
From source file:Main.java
public static String removeExtension(String name) { if (name == null) return null; return name.replaceAll("\\.[^\\.]+$", ""); }