org.moyoman.util.igo
Class Str

java.lang.Object
  |
  +--org.moyoman.util.igo.Str

public class Str
extends Object

a utility class of String.


Constructor Summary
Str()
           
 
Method Summary
static String after(String src, String des)
          Get string after des.
static String atti(String src, String des)
          Get attribute.
static String charTrim(String str, char cc)
          Trim char from a string.
static String dat(String str, String tag, String lim)
          Get data form tags.
static String dat(String str, String tag, String lim, boolean addtag)
          Get data form tags.
static String del(String src, String des)
          Del string.
static String del(String src, String des, boolean all)
          Del string.
static boolean empty(String str)
          Check the string is empty or not.
static boolean has(String src, String des)
          Check a string is in or not.
static String it(int i)
          Int to string.
static boolean out(String src, String des)
          Check a string is out or not.
static String replace(String src, String s1, String s2)
          Replace string.
static String replace(String src, String d1, String d2, boolean all)
          Replace string.
static String[] split(String str, String div)
          Split string.
static String[] split(String str, String head, String tail)
          Split string.
static int toInt(String str)
          String to int.
static int toInt(String str, int def)
          String to int.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Str

public Str()
Method Detail

dat

public static String dat(String str,
                         String tag,
                         String lim)
Get data form tags.

Parameters:
str - Src data.
tag - Tags.
lim - End of the tag.
Returns:
data in tags.

dat

public static String dat(String str,
                         String tag,
                         String lim,
                         boolean addtag)
Get data form tags.

Parameters:
str - Src data.
tag - Tags.
lim - End of the tag.
addtag - True if add tag string to the output.
Returns:
data in tags.

empty

public static boolean empty(String str)
Check the string is empty or not.

Parameters:
str - Src data.
Returns:
true if string is empty.

toInt

public static int toInt(String str)
String to int.

Parameters:
str - Src data.
Returns:
the int value.

toInt

public static int toInt(String str,
                        int def)
String to int.

Parameters:
str - Src data.
def - Default value.
Returns:
int value.

it

public static String it(int i)
Int to string.

Parameters:
i - The target int.
Returns:
a string of the int value.

has

public static boolean has(String src,
                          String des)
Check a string is in or not.

Parameters:
src - Src String.
des - Des String.
Returns:
true if src has des in it.

out

public static boolean out(String src,
                          String des)
Check a string is out or not.

Parameters:
src - Src String.
des - Des String.
Returns:
true if src has no des in it.

after

public static String after(String src,
                           String des)
Get string after des.

Parameters:
src - Src String.
des - Des String.
Returns:
string after des.

replace

public static String replace(String src,
                             String s1,
                             String s2)
Replace string.

Parameters:
src - Src String.
s1 - Old String.
s2 - New String.
Returns:
a replaced string.

replace

public static String replace(String src,
                             String d1,
                             String d2,
                             boolean all)
Replace string.

Parameters:
src - Src String.
d1 - Old String.
d2 - New String.
all - True if replace all.
Returns:
a replaced string.

del

public static String del(String src,
                         String des)
Del string.

Parameters:
src - Src String.
des - Des String.
Returns:
new string after del.

del

public static String del(String src,
                         String des,
                         boolean all)
Del string.

Parameters:
src - Src String.
des - Des String.
all - True if del all.
Returns:
new string after del.

split

public static String[] split(String str,
                             String div)
Split string.

Parameters:
str - Src String.
div - Divide String.
Returns:
a array of splited string.

split

public static String[] split(String str,
                             String head,
                             String tail)
Split string.

Parameters:
str - Src String.
head - Start of divide.
tail - End of divide.
Returns:
a array of splited string.

atti

public static String atti(String src,
                          String des)
Get attribute.

Parameters:
src - Src String.
des - Des String.
Returns:
attribute string.

charTrim

public static String charTrim(String str,
                              char cc)
Trim char from a string.

Parameters:
str - Src String.
cc - char to trim.
Returns:
a trimed string.