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

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

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

origin: edu.ucar/netcdf

 /**
  * Clean up strings to be used in Netcdf Object names
  * @param name original name
  * @return cleaned up name
  */
 static public String cleanName(String name) {
  if (name == null) return null;
  int pos = name.indexOf("(see");
  if (pos < 0) pos = name.indexOf("(See");
  if (pos > 0) name = name.substring(0,pos);

  name = StringUtil2.replace(name, '/', "-");
  StringBuilder sb = new StringBuilder(name);
  StringUtil2.remove(sb, ".;,=[]()/*\"");
  return StringUtil2.collapseWhitespace(sb.toString().trim());
 }
}
origin: edu.ucar/cdm

/**
 * Clean up strings to be used in Netcdf Object names
 * @param name original name
 * @return cleaned up name
 */
static public String cleanName(String name) {
 if (name == null) return null;
 int pos = name.indexOf("(see");
 if (pos < 0) pos = name.indexOf("(See");
 if (pos > 0) name = name.substring(0,pos);
 name = StringUtil2.replace(name, '/', "-");
 StringBuilder sb = new StringBuilder(name);
 StringUtil2.replace(sb, '+', "plus");
 StringUtil2.remove(sb, ".;,=[]()/*\"");
 return StringUtil2.collapseWhitespace(sb.toString().trim());
}
origin: Unidata/thredds

/**
 * Clean up strings to be used in Netcdf Object names
 * @param name original name
 * @return cleaned up name
 */
static public String cleanName(String name) {
 if (name == null) return null;
 int pos = name.indexOf("(see");
 if (pos < 0) pos = name.indexOf("(See");
 if (pos > 0) name = name.substring(0,pos);
 name = StringUtil2.replace(name, '/', "-");
 StringBuilder sb = new StringBuilder(name);
 StringUtil2.replace(sb, '+', "plus");
 StringUtil2.remove(sb, ".;,=[]()/*\"");
 return StringUtil2.collapseWhitespace(sb.toString().trim());
}
origin: Unidata/thredds

 public HashMap<Integer, Grib1Parameter> parseXml(Element root) {
  HashMap<Integer, Grib1Parameter> result = new HashMap<>();
  Element fnmocTable = root.getChild("fnmocTable");
  List<Element> params = fnmocTable.getChildren("entry");
  for (Element elem1 : params) {
   int code;
   try {
    code = Integer.parseInt(elem1.getChildText("grib1Id"));
   } catch (NumberFormatException e) {
    System.out.printf("BAD number= %s%n", elem1.getChildText("grib1Id"));
    continue;
   }
   String desc = elem1.getChildText("description");
   if (desc == null) continue;
   //if (desc.startsWith("no definition")) continue; // skip; use standard def
   desc = StringUtil2.collapseWhitespace(desc);
   String units = elem1.getChildText("unitsFNMOC");
   if (units == null) units = "";
   String name = elem1.getChildText("name");
   Grib1Parameter parameter = new Grib1Parameter(Grib1ParamTableReader.this, code, name, desc, units, null);
   result.put(parameter.getNumber(), parameter);
   if (debug) System.out.printf(" %s%n", parameter);
  }
  useName = true;
  return result;
 }
}
ucar.unidata.utilStringUtil2collapseWhitespace

Javadoc

Collapse continuous whitespace into one single " ".

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
  • 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().
  • 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?
  • Github Copilot alternatives
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