List of usage examples for org.apache.commons.lang StringUtils replace
public static String replace(String text, String searchString, String replacement)
Replaces all occurrences of a String within another String.
From source file:com.sfs.whichdoctor.beans.IsbPayloadBean.java
/** * Gets the formatted xml payload.//from w w w. j a va 2 s .c o m * * @return the formatted xml payload */ public final String getFormattedXmlPayload() { return StringUtils.replace(getTabbedXmlPayload(), "\n", "<br/>"); }
From source file:info.magnolia.cms.gui.controlx.search.SearchControlDefinition.java
/** * @param name The name to set./* w w w . j a v a2s . co m*/ */ public void setName(String name) { if (StringUtils.isEmpty(this.getColumn())) { this.setColumn(name); } // avoid broken javascripts this.name = StringUtils.replace(name, ":", "_"); }
From source file:com.bstek.dorado.core.resource.DefaultGlobalResourceBundleManager.java
protected Resource findResourceInPath(String searchPath, String bundleName, Locale locale) throws Exception { Resource resource = null;//www .ja v a 2 s .c o m bundleName = StringUtils.replace(bundleName, ".", "/"); String path = PathUtils.concatPath(searchPath, bundleName); if (locale != null) { String localeSuffix = '.' + locale.toString(); resource = ResourceUtils.getResource(path + localeSuffix + RESOURCE_FILE_SUFFIX); if (resource != null && resource.exists()) { return resource; } } resource = ResourceUtils.getResource(path + RESOURCE_FILE_SUFFIX); if (resource != null && resource.exists()) { return resource; } return null; }
From source file:er.extensions.components.ERXStringWithLineBreaks.java
protected String valueToString(Object value) { String result = null;//from www .j a v a2s . c o m if (value != null) { result = (value instanceof String) ? (String) value : value.toString(); result = WOMessage.stringByEscapingHTMLString(result); // FIXME: This could be optimized result = StringUtils.replace(result, "\r\n", "\r"); result = StringUtils.replace(result, "\n", "\r"); result = StringUtils.replace(result, "\r", br()); result = StringUtils.replace(result, "\t", tabs()); } return result; }
From source file:de.fhg.iais.asc.commons.exceptions.AscReportableErrorException.java
public ErrorSip createErrorSip(String section, String filename, String itemId, Document source, Document failedSip) {//from w ww . j a va2s . co m String messages = getAllErrorMessages(this, new ArrayList<String>()); ErrorReport error = new ErrorReport(itemId, filename, StringUtils.replace(messages, "\"", "'"), this.errorType); ErrorSip errorSip = new ErrorSip(section, error, source, failedSip); return errorSip; }
From source file:edu.ku.brc.specify.tools.datamodelgenerator.DataDict.java
/** * @param text/*w ww . j ava 2 s . co m*/ * @return */ protected String getText(final String text) { String desc = StringUtils.replace(StringUtils.remove(text, '\n'), " ", " "); desc = StringUtils.replace(desc, " ", " "); desc = StringUtils.replace(desc, " ", " "); desc = StringEscapeUtils.escapeXml(desc); desc = StringUtils.replace(desc, "&apos;", "'"); desc = StringUtils.replace(desc, " ", " "); desc = StringUtils.replace(desc, " ", " "); if (StringUtils.isNotBlank(desc)) { return desc; } return ""; }
From source file:com.google.gdt.eclipse.designer.gwtext.ComponentTest.java
/** * Users often try to use GWT-Ext in module which is not configured correctly. So, we should check * this and show good message./*from w ww . ja va2 s .co m*/ * <p> * http://fogbugz.instantiations.com/fogbugz/default.php?43409 */ @DisposeProjectAfter public void test_notConfiguredCorrectly() throws Exception { dontUseSharedGWTState(); // remove Ext scripts { IFile moduleFile = getFileSrc("test/Module.gwt.xml"); String content = getFileContent(moduleFile); content = StringUtils.replace(content, "<script src=\"", "<script src=\"bad/"); setFileContent(moduleFile, content); } // try to parse, failure expected try { parseJavaInfo("public class Test implements EntryPoint {", " public void onModuleLoad() {", " RootPanel rootPanel = RootPanel.get();", " {", " Button button = new Button();", " rootPanel.add(button);", " }", " }", "}"); fail(); } catch (Throwable e) { DesignerException de = DesignerExceptionUtils.getDesignerException(e); assertEquals(de.getCode(), IExceptionConstants.NOT_CONFIGURED); assertTrue(DesignerExceptionUtils.isWarning(e)); } }
From source file:info.magnolia.module.delta.BootstrapConditionally.java
private static String cleanupFilename(String filename) { filename = StringUtils.replace(filename, "\\", "/"); filename = StringUtils.substringAfterLast(filename, "/"); filename = StringUtils.substringBeforeLast(filename, "."); return StringUtils.removeEnd(filename, DataTransporter.XML); }
From source file:com.google.gdt.eclipse.designer.uibinder.wizards.UiBinderWizardPage.java
protected void createUI() throws Exception { IType newType = getCreatedType();/*from w w w. j a va 2 s.c o m*/ // prepare template String template; { String templatePath = getTemplatePath_UI(); InputStream templateStream = Activator.getFile(templatePath); template = IOUtils2.readString(templateStream); } // prepare content String content; { String qualifiedTypeName = newType.getFullyQualifiedName(); content = StringUtils.replace(template, "%TypeName%", qualifiedTypeName); } // create UiBinder file IFolder folder = (IFolder) getPackageFragment().getUnderlyingResource(); m_uiFile = folder.getFile(newType.getElementName() + ".ui.xml"); IOUtils2.setFileContents(m_uiFile, content); m_uiFile.setCharset("UTF-8", null); }
From source file:info.magnolia.cms.util.FreeMarkerUtil.java
public static String createTemplateName(Class klass, String ext) { return "/" + StringUtils.replace(klass.getName(), ".", "/") + "." + ext; }