List of usage examples for java.lang String replace
public String replace(CharSequence target, CharSequence replacement)
From source file:com.redhat.lightblue.eval.EvalTestContext.java
public static UpdateExpression updateExpressionFromJson(String s) throws Exception { return UpdateExpression.fromJson(JsonUtils.json(s.replace('\'', '\"'))); }
From source file:JSONUtil.java
/** * @param namedItem// w w w.j av a 2 s .c o m * @return */ public static String safeId(String nodeName) { nodeName = nodeName.replace(' ', '-'); nodeName = nodeName.replace('_', '-'); nodeName = nodeName.replace('"', '-'); nodeName = nodeName.replace(';', '-'); nodeName = nodeName.replace(',', '-'); nodeName = nodeName.replace('\'', '-'); nodeName = nodeName.replace('(', '-'); nodeName = nodeName.replace(')', '-'); nodeName = nodeName.replace('.', '-'); nodeName = nodeName.replace('/', '-'); nodeName = nodeName.replace('?', '-'); return nodeName; }
From source file:com.haulmont.cuba.web.gui.FileUploadTypesHelper.java
public static String convertSeparator(String types, String originSeparator, String separator) { return StringUtils.isNotBlank(types) ? types.replace(originSeparator, separator) : null; }
From source file:de.arraying.arraybot.util.UFormatting.java
/** * Strips all the formatting by escaping it. * @param input The input./*from w w w. j a v a 2 s. co m*/ * @return A stripped string. */ public static String stripFormatting(String input) { for (char markup : MARKUP_CHARS) { input = input.replace(String.valueOf(markup), "\\" + markup); } return input; }
From source file:Main.java
public static String clearFractions(String __text) { // Removes all fraction characters from a string for (String key : fractions.keySet()) { __text = __text.replace(fractions.get(key), ""); }// w ww. ja va2 s .c o m return __text; }
From source file:Main.java
private static String doReplace(String s, String propertyName, String defaultValue) { String sysProp = System.getProperty(propertyName); s = s.replace("${" + propertyName + ":" + defaultValue + "}", sysProp == null ? defaultValue : sysProp); return s;/*from w w w. ja v a2 s .co m*/ }
From source file:Main.java
/** * Parse a URL query and fragment parameters into a key-value bundle. * /*from w w w.j a va 2 s. c o m*/ * @param url * the URL to parse * @return a dictionary bundle of keys and values */ public static Map<String, String> parseUrl(String url) { // hack to prevent MalformedURLException url = url.replace("fbconnect", "http"); try { URL u = new URL(url); Map<String, String> params = decodeUrl(u.getQuery()); params.putAll(decodeUrl(u.getRef())); return params; } catch (MalformedURLException e) { return new HashMap<String, String>(); } }
From source file:ch.systemsx.cisd.openbis.generic.shared.translator.AttachmentTranslator.java
private static String getFileName(String filePath) { int lastIndexOfSeparator = filePath.replace('\\', '/').lastIndexOf('/'); return lastIndexOfSeparator < 0 ? filePath : filePath.substring(lastIndexOfSeparator + 1); }
From source file:com.microsoft.alm.common.utils.SystemHelper.java
/** * Takes in a path and converts it to Unix standard if Windows OS is detected * * @param path/*w ww . j av a 2 s. co m*/ * @return path with forward slashes */ public static String getUnixPath(final String path) { if (Platform.isWindows()) { return path.replace("\\", "/"); } else { return path; } }
From source file:Main.java
public static Boolean mkDirs(String filePath) { //int startind=1; String dirPath = new File(filePath).getParentFile().getAbsolutePath() + File.separator; File dir = new File(dirPath.replace("/", File.separator)); return dir.exists() || dir.mkdirs(); // while(true){ // if(startind>=dirPath.length()||startind==-1) // return true; // int slashInd=dirPath.indexOf(File.separator,startind); // if(slashInd==-1)return true; // String subPath=dirPath.substring(0,slashInd); // File f=new File(subPath); // if(!f.exists()&&!f.mkdir()){ // return false; // } // startind=subPath.length()+1; ///*ww w.j a v a2 s . c o m*/ // } }