List of usage examples for java.lang String replace
public String replace(CharSequence target, CharSequence replacement)
From source file:dk.dma.ais.abnormal.util.AisDataHelper.java
/** * Trim AIS string to Java String by converting all '@'s to spaces, and then * trimming all leading and trailing spaces away. * * @param name//from w ww. ja v a 2 s .c o m * @return */ public static String trimAisString(String name) { if (!Strings.isNullOrEmpty(name)) { name = name.replace('@', ' ').trim(); } else { name = ""; } return name; }
From source file:edu.uoa.cs.master.cloudmanufacturingnlp.util.Tools.java
public static String replaceSpecialCharacters(String originalString) { return originalString.replace("<-", "<-").replace("; ", "<br/>"); }
From source file:gov.nih.nci.cabig.caaers.utils.CaaersUtils.java
/** * This method will return String//from w ww.j a va2 s .c o m * @param inputString * @return */ /* * This method is used by the ReportVersion and the Reporter objects, which store email as a string */ public static String getEmailStringWithoutSemiColonsAndSpaces(String inputString) { if (StringUtils.isBlank(inputString)) { return null; } return inputString.replace(";", ",").replace(" ", ""); }
From source file:info.mikaelsvensson.devtools.common.PathUtils.java
private static String fixPath(final File source) { String fixed = source.getAbsolutePath(); if (File.separatorChar != SEP) { fixed = fixed.replace(File.separatorChar, SEP); }/*from w w w . jav a 2s.c o m*/ return source.isDirectory() ? trailingSlash(fixed) : fixed; }
From source file:io.cortical.model.TestExpressionFactory.java
private static String prepareJson(String json) { return json.replace("\n", "").replace("\r", ""); }
From source file:Main.java
/** * Creates a double quoted Javascript string, escaping backslashes, forward slashes, single * quotes, double quotes, and escape characters. *///from ww w. j a v a 2 s . c om public static String makeJsString(String str) { // TODO(#17): More complete character escaping: unicode characters to hex, octal, or \\u. String escapedStr = str.replace("\\", "\\\\") // Must escape backslashes first. .replace("</", "<\\/") // See: http://stackoverflow.com/a/6117915 .replace("\'", "\\\'").replace("\"", "\\\"").replace("\b", "\\b").replace("\f", "\\f") .replace("\n", "\\n").replace("\r", "\\r").replace("\t", "\\t"); return "\"" + escapedStr + "\""; }
From source file:ch.unifr.pai.twice.widgets.mpProxyScreenShot.server.ReadOnlyPresentation.java
public static String getScreenshotForUUID(String uuid) { if (uuid == null) return null; Screenshot s = uuidToScreenshot.get(uuid); String html = s.html; html = html.replace("<body", "<body style=\"overflow:hidden; zoom: " + scaleFactor + "!important; -moz-transform: scale(" + scaleFactor + "); -moz-transform-origin: 0 0;\""); //html = html.replaceAll("<div id=\"miceNavigation\".*?</div>", ""); //html = html.replaceAll("<div id=\"contentWrapper\".?>", ""); //html = html.replace("</div></body>", "</div>"); html = html.replace("</body>", "<script>document.body.scrollTop=" + (s.top * scrollFactor) + ";document.body.scrollLeft=" + (s.left * scrollFactor) + ";</script></body>"); return s != null ? html : null; }
From source file:com.haulmont.cuba.core.global.TemplateHelper.java
protected static Map<String, Object> prepareParams(Map<String, ?> parameterValues) { Map<String, Object> parameterValuesWithStats = new HashMap<>(parameterValues); parameterValuesWithStats.put("statics", BeansWrapper.getDefaultInstance().getStaticModels()); @SuppressWarnings("unchecked") Map<String, Object> params = LazyMap.lazyMap(parameterValuesWithStats, propertyName -> { for (String appProperty : AppContext.getPropertyNames()) { if (appProperty.replace(".", "_").equals(propertyName)) { return AppContext.getProperty(propertyName); }//ww w . ja v a2s.c om } return null; }); return params; }
From source file:com.nearinfinity.mele.util.ZkUtils.java
private static String removeDupSeps(String path) { return path.replace("//", "/"); }