com.ijchart.xychart.util
Class StringUtil

java.lang.Object
  extended by com.ijchart.xychart.util.StringUtil

public abstract class StringUtil
extends java.lang.Object

Title: IJChart

Description: a chart library for the Java(tm) platform.

Nice static helpers for working with Strings

Copyright: Copyright (c) 2013

Company:

Version:
1.0
Author:
zhang feng min,shanghai china. Contract me by email.

Constructor Summary
StringUtil()
           
 
Method Summary
static boolean isEmpty(java.lang.String str)
           Test whether or not string is null or empty.
static boolean isEmpty(java.lang.String[] arr, boolean trim)
           Returns whether or not an array of elements are as null.
static boolean isEmptyWithTrim(java.lang.String str)
           Test whether or not string is null or String.trim() return empty.
static java.lang.String javascriptEscape(java.lang.String str)
           Returns a string that is equivalent to the input string, but with special characters converted to JavaScript escape sequences.
static java.lang.String nullToEmpty(java.lang.String str)
           If str is null return empty string,otherwise return str.
static java.lang.Object nullToString(java.lang.Object obj)
           If str is null return "null",otherwise return str.
static java.lang.String[] removeRepeatValues(java.lang.String[] values)
           Remove repeat values and reserve the center object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtil

public StringUtil()
Method Detail

isEmpty

public static boolean isEmpty(java.lang.String str)
Test whether or not string is null or empty.

Parameters:
str - String The test string.
Returns:
boolean If string is null or empty return true,otherwise return false.

isEmptyWithTrim

public static boolean isEmptyWithTrim(java.lang.String str)
Test whether or not string is null or String.trim() return empty.

Parameters:
str - String The test string.
Returns:
boolean If string is null or empty or String.trim() is empty return true, otherwise return false.

nullToEmpty

public static java.lang.String nullToEmpty(java.lang.String str)
If str is null return empty string,otherwise return str.

Parameters:
str - String A string (null permitted).
Returns:
String

nullToString

public static java.lang.Object nullToString(java.lang.Object obj)
If str is null return "null",otherwise return str.

Parameters:
obj - Object A Object (null permitted).
Returns:
String

isEmpty

public static boolean isEmpty(java.lang.String[] arr,
                              boolean trim)
Returns whether or not an array of elements are as null.

Parameters:
arr - String[] An array (null permitted).
trim - boolean Whether or not trim space.
Returns:
boolean

removeRepeatValues

public static java.lang.String[] removeRepeatValues(java.lang.String[] values)
Remove repeat values and reserve the center object.

Parameters:
values - String[] The array of labels.
Returns:
String[] The result.

javascriptEscape

public static java.lang.String javascriptEscape(java.lang.String str)
Returns a string that is equivalent to the input string, but with special characters converted to JavaScript escape sequences.

Parameters:
str - String The input string (null permitted).
Returns:
String The result string (never null).