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

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

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

origin: edu.ucar/netcdf

 /**
 * Replace special characters with entities for XML attributes.
 * special: '&', '<', '>', '\'', '"', '\r', '\n'
 *
 * @param x string to quote
 * @return equivilent string using entities for any special chars
 */
static public String quoteXmlContent(String x) {
 return StringUtil2.replace(x, xmlInC, xmlOutC);
}
origin: edu.ucar/netcdf

/**
 * Replace special characters with entities for HTML content.
 * special: '&', '"', '\'', '<', '>', '\n'
 *
 * @param x string to quote
 * @return equivilent string using entities for any special chars
 */
static public String quoteHtmlContent(String x) {
 return replace(x, htmlIn, htmlOut);
}
origin: edu.ucar/cdm

/**
 * Replace special characters with entities for HTML content.
 * special: '&', '"', '\'', '<', '>', '\n'
 *
 * @param x string to quote
 * @return equivilent string using entities for any special chars
 */
static public String quoteHtmlContent(String x) {
 return replace(x, htmlIn, htmlOut);
}
origin: edu.ucar/cdm

/**
 * Replace special characters with entities for XML attributes.
 * special: '&', '<', '>', '\'', '"', '\r', '\n'
 *
 * @param x string to quote
 * @return equivilent string using entities for any special chars
 */
static public String quoteXmlAttribute(String x) {
 return replace(x, xmlIn, xmlOut);
}
origin: edu.ucar/cdm

 /**
 * Replace special characters with entities for XML attributes.
 * special: '&', '<', '>', '\'', '"', '\r', '\n'
 *
 * @param x string to quote
 * @return equivilent string using entities for any special chars
 */
static public String quoteXmlContent(String x) {
 return StringUtil2.replace(x, xmlInC, xmlOutC);
}
origin: Unidata/thredds

 /**
  * @deprecated legacy only, use HtmlEscapers.htmlEscaper()
  */
 static public String quoteHtmlContent(String x) {
  if (x == null) return null;
  return replace(x, htmlIn, htmlOut);
 }
}
origin: edu.ucar/netcdf

public static String[] getDefinitionFiles() {
 if (fmrcDefinitionFiles == null) {
  fmrcDefinitionFiles = new String[fmrcDatasets.length];
  int count = 0;
  for (String ds : fmrcDatasets) {
   fmrcDefinitionFiles[count++] = fmrcDefinitionDir + StringUtil2.replace(ds, '/', "-") + ".fmrcDefinition.xml";
  }
 }
 return fmrcDefinitionFiles;
}
origin: edu.ucar/netcdf

/**
 * Replace special characters '\t', '\n', '\f', '\r'.
 *
 * @param s string to quote
 * @return equivilent string replacing special chars
 */
static public String encodeString(String s) {
 return StringUtil2.replace(s, org, replace);
}
origin: edu.ucar/netcdf

/**
 * Replace special characters with entities for XML attributes.
 * special: '&', '<', '>', '\'', '"', '\r', '\n'
 *
 * @param x string to quote
 * @return equivilent string using entities for any special chars
 */
static public String quoteXmlContent(String x) {
 return replace(x, xmlInC, xmlOutC);
}
origin: Unidata/thredds

/**
 * Replace special characters '\t', '\n', '\f', '\r'.
 *
 * @param s string to quote
 * @return equivilent string replacing special chars
 */
static public String encodeString(String s) {
 return StringUtil2.replace(s, org, replace);
}
origin: edu.ucar/netcdf

public static String[] getRoots() {
 String rootString = StringUtil2.replace(roots, "\n", ",");
 String[] root2 = rootString.split(",");
 String[] result = new String[root2.length/2];
 for (int i = 0; i < root2.length; i += 2) {
  result[i/2] = root2[i];
 }
 return result;
}
origin: edu.ucar/cdm

@Override
public String getPath() {
 // no microsnot
 return StringUtil2.replace(file.getPath(), '\\', "/");
}
origin: edu.ucar/netcdf

static public String cleanName(String name) {
 if (name == null)
  System.out.println("HEY cleanName");
 return StringUtil2.replace(name.trim(), ' ', "_");  // LOOK must be ok in URL - probably not sufficient here
}
origin: Unidata/thredds

@Override
public String getPath() {
 String path =  new File(directory, name).getPath();
 return StringUtil2.replace(path, '\\', "/");
}
origin: Unidata/thredds

 @Override
 public boolean accept(Path entry) throws IOException {

  String matchOn = nameOnly ? entry.getName(entry.getNameCount()-1).toString() : StringUtil2.replace(entry.toString(), "\\", "/");

  java.util.regex.Matcher matcher = this.pattern.matcher(matchOn);
  boolean ok =  matcher.matches();
  //System.out.printf("%s %s%n", ok, matchOn);
  return ok;
 }
}
origin: Unidata/thredds

 public FileCacheable open(DatasetUrl durl, int buffer_size, CancelTask cancelTask, Object iospMessage) throws IOException {
  String location = StringUtil2.replace(durl.trueurl, "\\", "/"); // canonicalize the name
  RandomAccessFile result = new RandomAccessFile(location, "r", buffer_size);
  result.cacheState = 1;  // in use
  return result;
 }
};
origin: edu.ucar/netcdf

public CacheDirectory(File dir) {
 super(dir);
 this.parentDirName =  StringUtil2.replace(dir.getParent(), '\\', "/");
 File[] subs = dir.listFiles();
 if (subs == null) subs = new File[0];
 children = new CacheFile[subs.length];
 int count = 0;
 for (File f : subs) {
  children[count++] = new CacheFile(f);
 }
}
origin: edu.ucar/netcdf

/**
 * Set the cache root directory. Create it if it doesnt exist.
 *
 * @param cacheDir the cache directory
 */
static public void setRootDirectory(String cacheDir) {
 if (!cacheDir.endsWith("/"))
  cacheDir = cacheDir + "/";
 root = StringUtil2.replace(cacheDir, '\\', "/"); // no nasty backslash
 makeRootDirectory();
}
origin: edu.ucar/netcdf

public static PathMatcher readRoots() {
 PathMatcher pathMatcher = new PathMatcher();
 String rootString = StringUtil2.replace(roots, "\n", ",");
 String[] roots = rootString.split(",");
 for (int i = 0; i < roots.length; i += 2) {
  if (showRoots) System.out.printf("  %-40s %-40s%n", roots[i], roots[i + 1]);
  pathMatcher.put(roots[i], roots[i + 1]);
 }
 return pathMatcher;
}
origin: Unidata/thredds

public String makeId() {
 LatLonPointImpl center = (LatLonPointImpl) getCenterLatLon();
 StringBuilder result = new StringBuilder(name + "_" + ny + "X" + nx+"-"+center.toString(2));
 StringUtil2.replace(result, ". ","p-");
 return result.toString();
}
ucar.unidata.utilStringUtil2replace

Javadoc

Replace any char "out" in s with "in".

Popular methods of StringUtil2

  • remove
    Remove any of the characters in out from sb
  • substitute
    Find all occurences of the "match" in original, and substitute the "subst" string, directly into the
  • 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

  • Creating JSON documents from java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • compareTo (BigDecimal)
  • setScale (BigDecimal)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • BoxLayout (javax.swing)
  • Top Vim plugins
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