public class

NumberParser

extends Object
java.lang.Object
   ↳ com.microstrategy.utils.NumberParser

Class Overview

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.

Summary

Public Constructors
NumberParser()
Public Methods
static boolean isNumber(String str, Locale locale)
Returns true if the string is a number in the specified locale.
static String stripWhiteSpaces(String str, Locale locale)
Strip off the white space characters within the string if the locale is French or Swedish only, otherwise returns the original string.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public NumberParser ()

Public Methods

public static boolean isNumber (String str, 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.

public static String stripWhiteSpaces (String str, 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.