List of usage examples for java.lang String trim
public String trim()
From source file:Main.java
public static String clearXSSMinimum(String value) { if (value == null || value.trim().equals("")) { return ""; }/* w w w. j ava2 s . c om*/ String returnValue = value; returnValue = returnValue.replaceAll("&", "&"); returnValue = returnValue.replaceAll("<", "<"); returnValue = returnValue.replaceAll(">", ">"); returnValue = returnValue.replaceAll("\"", """); returnValue = returnValue.replaceAll("\'", "'"); return returnValue; }
From source file:Main.java
/** * Get an ArrayList from a String of comma separated values * //from www . j a v a 2 s . c o m * @param csvStr comma separated values * @return ArrayList ArrayList of the values */ public static ArrayList<String> getListFromCsvString(String csvStr) { ArrayList<String> arrList = new ArrayList<String>(); for (String x : csvStr.split(",")) { x = x.trim(); arrList.add(x); } return arrList; }
From source file:Main.java
public static String getClipboard() { Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null); try {//from w w w. j a va 2 s.c o m if (t != null && t.isDataFlavorSupported(DataFlavor.stringFlavor)) { String text = (String) t.getTransferData(DataFlavor.stringFlavor); return text.trim(); } } catch (Exception e) { } return ""; }
From source file:Main.java
static String stripSurroundingRegExpSlashes(String regexp) { return regexp != null ? regexp.trim().replaceAll("^/|/$", "").trim() : null; }
From source file:Main.java
public static boolean isEmail(String email) { if ((email == null) || (email.trim().equals(""))) { return false; }/*from w ww . j av a 2s . co m*/ String emailRegular = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$"; Pattern regex = Pattern.compile(emailRegular); Matcher matcher = regex.matcher(email); boolean isMatched = matcher.matches(); return isMatched; }
From source file:io.github.benas.jql.shell.Shell.java
private static void process(String command) { if (!command.trim().isEmpty()) { try {//from w w w.ja v a2 s. c o m System.out.println(queryExecutor.execute(command, resultSetExtractor)); } catch (DataAccessException e) { System.err.println("Unable to execute query: " + command); System.err.println(e.getRootCause().getMessage()); } } }
From source file:Main.java
static String addSurroundingRegExpSlashes(String str) { return "/" + (str != null ? str.trim() : "") + "/"; }
From source file:Main.java
private static boolean match(String str, String rex) { if (null == str || str.trim().length() == 0) { return false; }//from w w w .j a v a 2s . c o m Pattern pattern = Pattern.compile(rex); Matcher isNum = pattern.matcher(str); return isNum.matches(); }
From source file:Main.java
public static boolean az(String var0) { return var0 == null || var0.length() == 0 || var0.trim().isEmpty(); }
From source file:Main.java
static String noSpaces(String s) { return (s == null) ? null : s.trim().replaceAll("\\s+", "_").replaceAll("/", "-").replaceAll("\\*", "+").replaceAll("\\\\", ""); }