com.opera.core.systems.common.lang
Class OperaStrings

java.lang.Object
  extended by com.opera.core.systems.common.lang.OperaStrings

public class OperaStrings
extends Object

OperaStrings should be considered a supplement to Strings in Guava.


Constructor Summary
OperaStrings()
           
 
Method Summary
static String escapeJsString(String string)
          Escape characters for safe insertion in a Javascript string contained by double quotes (").
static String escapeJsString(String string, String quote)
          Escape characters for safe insertion in a JavaScript string.
static boolean isDouble(String string)
          Checks whether given string has a double value.
static boolean isInteger(String string)
          Checks whether the given string has an integer value.
static boolean isNumeric(String string)
          Checks whether given string has a numeric value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperaStrings

public OperaStrings()
Method Detail

isNumeric

public static boolean isNumeric(String string)
Checks whether given string has a numeric value. A numeric value may be "1234", "0" or "1.23".

Parameters:
string - the string to check
Returns:
true if string holds a numeric value, false otherwise

isDouble

public static boolean isDouble(String string)
Checks whether given string has a double value.

Parameters:
string - the string to check
Returns:
true if string resembles a double value, false otherwise

isInteger

public static boolean isInteger(String string)
Checks whether the given string has an integer value.

Parameters:
string - the string to check
Returns:
true if string resembles an integer value, false otherwise

escapeJsString

public static String escapeJsString(String string)
Escape characters for safe insertion in a Javascript string contained by double quotes (").

Parameters:
string - the string to escape
Returns:
an escaped string

escapeJsString

public static String escapeJsString(String string,
                                    String quote)
Escape characters for safe insertion in a JavaScript string.

Parameters:
string - the string to escape
quote - the type of quote to escape. Either " or '
Returns:
the escaped string


Copyright © 2012. All Rights Reserved.