Class NumberParser


  • public class NumberParser
    extends java.lang.Object
    This class is intended to parse a string into a number based on Locale. Callers of this class should not pass in null String, otherwise java.lang.NullPointerException is thrown.
    Since:
    MicroStrategy Web 7.3.1 or earlier
    • Constructor Summary

      Constructors 
      Constructor Description
      NumberParser()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isNumber​(java.lang.String str, java.util.Locale locale)
      Returns true if the string is a number in the specified locale.
      static java.lang.String stripWhiteSpaces​(java.lang.String str, java.util.Locale locale)
      Strip off the white space characters within the string if the locale is French or Swedish only, otherwise returns the original string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NumberParser

        public NumberParser()
    • Method Detail

      • isNumber

        public static boolean isNumber​(java.lang.String str,
                                       java.util.Locale locale)
        Returns true if the string is a number in the specified locale. In case of French and Swedish language, all the white space characters contained within the string are ignored. In other languages, keep the string as is when parsing.
        Parameters:
        str - the string to parse
        locale - the java.lang.Locale
        Returns:
        true if the string is a number in the specified locale.
      • stripWhiteSpaces

        public static java.lang.String stripWhiteSpaces​(java.lang.String str,
                                                        java.util.Locale locale)
        Strip off the white space characters within the string if the locale is French or Swedish only, otherwise returns the original string.
        Parameters:
        str - the string whose white space characters needs to be stripped
        locale - the java.util.Locale
        Returns:
        a new string with white space charaters free.