Tabnine Logo
StringUtil2.substitute
Code IndexAdd Tabnine to your IDE (free)

How to use
substitute
method
in
ucar.unidata.util.StringUtil2

Best Java code snippets using ucar.unidata.util.StringUtil2.substitute (Showing top 20 results out of 315)

origin: Unidata/thredds

private String unescapeAttributeStringValues(String value) {
 return StringUtil2.substitute(value, substAttributeStrings, escapeAttributeStrings);
}
origin: Unidata/thredds

public static void addAlias(String aliasKey, String actual) {
 alias.put(aliasKey, StringUtil2.substitute(actual, "\\", "/"));
}
origin: edu.ucar/netcdf

private void appendQueryFromTemplate( StringBuffer sbuff, ArrayList choices) {
 StringBuilder templateBuff = new StringBuilder( template);
 for (int i=0; i<choices.size(); i+=2) {
  StringUtil2.substitute(templateBuff, choices.get(i).toString(), choices.get(i + 1).toString());
 }
 sbuff.append( templateBuff.toString());
}
origin: edu.ucar/cdm

private void appendQueryFromTemplate( StringBuffer sbuff, ArrayList choices) {
 StringBuilder templateBuff = new StringBuilder( template);
 for (int i=0; i<choices.size(); i+=2) {
  StringUtil2.substitute(templateBuff, choices.get(i).toString(), choices.get(i + 1).toString());
 }
 sbuff.append( templateBuff.toString());
}
origin: Unidata/thredds

private void appendQueryFromTemplate( StringBuffer sbuff, ArrayList choices) {
 StringBuilder templateBuff = new StringBuilder( template);
 for (int i=0; i<choices.size(); i+=2) {
  StringUtil2.substitute(templateBuff, choices.get(i).toString(), choices.get(i + 1).toString());
 }
 sbuff.append( templateBuff.toString());
}
origin: edu.ucar/cdm

private void transfer(String url, String copyToDir) {
 String new_url = StringUtil2.substitute(url, "dodsC", "fileServer");
 int pos = url.lastIndexOf('/');
 String filename = url.substring(pos + 1);
 File file = new File(copyToDir, filename);
 IO.readURLtoFile(new_url, file);
 System.out.println("  **copied to " + file.getPath() + " size=" + file.length());
}
origin: edu.ucar/netcdf

private void transfer(String url, String copyToDir) {
 String new_url = StringUtil2.substitute(url, "dodsC", "fileServer");
 int pos = url.lastIndexOf('/');
 String filename = url.substring(pos + 1);
 File file = new File(copyToDir, filename);
 IO.readURLtoFile(new_url, file);
 System.out.println("  **copied to " + file.getPath() + " size=" + file.length());
}
origin: Unidata/thredds

private void transfer(String url, String copyToDir) {
 String new_url = StringUtil2.substitute(url, "dodsC", "fileServer");
 int pos = url.lastIndexOf('/');
 String filename = url.substring(pos + 1);
 File file = new File(copyToDir, filename);
 IO.readURLtoFile(new_url, file);
 System.out.println("  **copied to " + file.getPath() + " size=" + file.length());
}
origin: edu.ucar/cdm

private String normalize(String units) {
 if (units.equals("/second")) units = "1/sec";
 if (units.equals("degrees K")) units = "K";
 else {
  units = StringUtil2.substitute(units, "**", "^");
  units = StringUtil2.remove(units, ')');
  units = StringUtil2.remove(units, '(');
 }
 return units;
}
origin: edu.ucar/netcdf

static public void makeReadOnlyCacheManager(String cacheDir, String cacheName) {
 String configString = StringUtil2.substitute(configReadOnly, "${cacheDir}", cacheDir);
 configString = StringUtil2.substitute(configString, "${cacheName}", cacheName);
 if (debugConfig) System.out.printf("CacheManager readonly =%n %s %n", configString);
 cacheManager = new net.sf.ehcache.CacheManager(new StringBufferInputStream(configString));
}
origin: Unidata/thredds

public ConfigCatalog getFromAbsolutePath(String catalogFullPath) throws IOException {
 catalogFullPath = StringUtil2.substitute(catalogFullPath, "\\", "/"); // nasty microsnot
 if (catalogFullPath.startsWith(rootPath)) {
  String catKey = catalogFullPath.substring(rootPath.length());
  // if (catKey.startsWith("/")) catKey = catKey.substring(1);
  return get(catKey);
 }
 return readCatalog(catalogFullPath);
}
origin: edu.ucar/netcdf

private String normalize(String units) {
 if (units.equals("fraction")) units = "";
 else if (units.equals("dimensionless")) units = "";
 else if (units.equals("NA")) units = "";
 else if (units.equals("-")) units = "";
 else {
  units = StringUtil2.substitute(units, "**", "^");
  units = StringUtil2.remove(units, '}');
  units = StringUtil2.remove(units, '{');
 }
 return units;
}
/////////////////////////////////////////////////////////////////////////
origin: edu.ucar/netcdf

private String normalize(String units) {
 if (units.equals("/second")) units = "1/sec";
 if (units.equals("degrees K")) units = "K";
 else {
  units = StringUtil2.substitute(units, "**", "^");
  units = StringUtil2.remove(units, ')');
  units = StringUtil2.remove(units, '(');
 }
 return units;
}
origin: Unidata/thredds

private String normalize(String units) {
 if (units.equals("/second")) units = "1/sec";
 if (units.equals("degrees K")) units = "K";
 else {
  units = StringUtil2.substitute(units, "**", "^");
  units = StringUtil2.remove(units, ')');
  units = StringUtil2.remove(units, '(');
 }
 return units;
}
origin: edu.ucar/netcdf

static public void makeTestCacheManager(String cacheDir) {
 String configString = StringUtil2.substitute(config, "${cacheDir}", cacheDir);
 if (debugConfig) System.out.printf("CacheManager test=%n %s %n", configString);
 cacheManager = new net.sf.ehcache.CacheManager(new StringBufferInputStream(configString));
}
origin: Unidata/thredds

static public String cleanupUnits(String unit) {
 if (unit == null) return null;
 if (unit.equalsIgnoreCase("-")) unit = "";
 else {
  if (unit.startsWith("/")) unit = "1" + unit;
  unit = unit.trim();
  unit = StringUtil2.remove(unit, "**");
  StringBuilder sb = new StringBuilder(unit);
  StringUtil2.remove(sb, "^[]");
  StringUtil2.substitute(sb, " / ", "/");
  StringUtil2.replace(sb, ' ', ".");
  StringUtil2.replace(sb, '*', ".");
  unit = sb.toString();
 }
 return unit;
}
origin: edu.ucar/netcdf

static public void makeStandardCacheManager(String configFile, String cacheDir) throws IOException {
 String config = IO.readFile(configFile);
 String configString = StringUtil2.substitute(config, "${cacheDir}", cacheDir);
 cacheLog.info("thredds.filesystem.CacheManager configuraton " + configString);
 cacheManager = new net.sf.ehcache.CacheManager(new StringBufferInputStream(configString));
}
origin: Unidata/thredds

@Test
public void problem() throws IOException {
 String problemFile = TestDir.cdmUnitTestDir + "formats/gempak/ndfd_20100913.gem";
 String name = StringUtil2.substitute(problemFile.substring(TestCdmRemoteCompareHeadersP.contentRoot.length()), "\\", "/");
 String remote = TestOnLocalServer.withHttpPath(TestCdmRemoteCompareHeadersP.urlPath + name);
 TestCdmRemoteCompareHeadersP.compareDatasets(problemFile, remote, false);
}
origin: Unidata/thredds

@Test
public void doOne() throws IOException {
 String name = StringUtil2.substitute(filename.substring(contentRoot.length()), "\\", "/");
 String remote = TestOnLocalServer.withHttpPath(urlPath + name);
 total++;
 success += compareDatasets(filename, remote, true);
}
origin: Unidata/thredds

@Test
public void doOne() throws IOException {
 String name = StringUtil2.substitute(filename.substring(contentRoot.length()), "\\", "/");
 String remote = TestOnLocalServer.withHttpPath(urlPath + name);
 total++;
 success += compareDatasets(filename, remote, false);
}
ucar.unidata.utilStringUtil2substitute

Javadoc

Find all occurrences of the "match" in original, and substitute the "subst" string.

Popular methods of StringUtil2

  • replace
    Replace any of the characters from out with corresponding character from in
  • remove
    Remove any of the characters in out from sb
  • cleanup
    Delete any non-printable characters
  • splitString
    Split a string on one or more whitespace. Cover for String.split, because who can remember regexp?
  • unescape
    This finds any '%xx' and converts to the equivalent char. Inverse of escape().
  • collapseWhitespace
    Collapse continuous whitespace into one single " ".
  • allow
    Replace any char not alphanumeric or in allowChars by replaceChar.
  • breakTextAtWords
    Break the given text into lines, respecting word boundaries (blank space).
  • escape
    Escape any char not alphanumeric or in okChars. Escape by replacing char with %xx (hex).
  • getTokens
  • makeValidCdmObjectName
  • padLeft
    Pad the given string with padString on the left up to the given length.
  • makeValidCdmObjectName,
  • padLeft,
  • padRight,
  • quoteHtmlContent,
  • unreplace,
  • filter7bits,
  • match,
  • quoteXmlAttribute,
  • removeFromEnd

Popular in Java

  • Finding current android device location
  • startActivity (Activity)
  • getContentResolver (Context)
  • getSupportFragmentManager (FragmentActivity)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Notification (javax.management)
  • IsNull (org.hamcrest.core)
    Is the value null?
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now