str的概率/length
@param str
@return
969602
public double normalise(String str) {
		double d = getProbability(str);
		d = d / str.length(); //词有长有短,乘以一个系数
		return d;
	}
407769
public static char lastChar(String str) {
	if (str == null || str.length() == 0) return 0;
	return str.charAt(str.length() - 1);
    }
699007
public int chn2Num(String str){
		Loc loc=new Loc();
		loc.v=0;
		int w=chn2Num(str,loc);
		if(loc.v==str.length())
			return w;
		else return -1;
	}
245916
public static String emptyToNull(String str) {
        return (str == null || str.length() == 0 ? null : str);
    }
496886
function(str, start) {
    return (str.length >= start.length &&
            str.substr(0, start.length) === start);
  }
603224
public static String substring(String str, int off, int len) {
	return str.substring(off, off + len);
    }
435504
public int indexOf(String str) {
        int i;

        for (i = 0; i < size; i++) {
            if (data[i].equals(str)) {
                return i;
            }
        }
        return -1;
    }
1320531
public static int calcUtfLength(String str) {
        final int strlen = str.length();
        int utflen = 0;
        for (int i = 0; i < strlen; i++) {
            int c = str.charAt(i);
            if ((c >= 0x0001) && (c <= 0x007F)) {
                utflen++;
            } else if (c > 0x07FF) {
                utflen += 3;
            } else {
                utflen += 2;
            }
        }
        return utflen;
    }
964304
private int writeString(String str) {
        int length = 0;
        try {
            byte[] buf = str.getBytes("ISO-8859-1");
            System.arraycopy(buf, 0, output, currentPos, buf.length);
            length = buf.length;
            currentPos += length;
        } catch (UnsupportedEncodingException e) {
            // This should never happen!
        }

        return length;
    }
838040
private static String checkBufferSize(final String str) {
        // try to get value
        int nb_mega;
        try {
            nb_mega = Integer.parseInt(str);
        } catch (final NumberFormatException e) {
            return null;
        }

        // Compute the real size and the power of 2
        final long size = (long) nb_mega * 1024 * 1024;
        long l = size;
        int cnt;
        for (cnt = 0; l > 0; cnt++) {
            l >>= 1;
        }
        cnt--;

        // Check if number ob Mb is not power of 2
        if (Math.pow(2, cnt) < size) {
            cnt++;
        }
        System.out.println(nb_mega + " Mbytes  (2^" + cnt + ")");

        final int jacorb_size = cnt - 4;
        return Integer.toString(jacorb_size);
    }
1310910
public static String getStrCode(int length) {
        StringBuffer str = new StringBuffer();
        while (str.length() <= length - 1)
            str.append(strArray[new Random().nextInt(strArray.length)]);
        return str.toString();
    }
382516
public static int length(String... args) {
        if (args == null)
            return 0;

        int acc = 0;
        for (String arg : args) {
            acc += arg.length();
        }
        return acc;
    }
921866
public String toTrad(String str) {   
		char[] c = str.toCharArray();
		for (int i = 0; i < str.length(); i++) {   
			char cc = s2l.get(c[i]);
			if (cc != 0) {   
				c[i] = cc;   
			} 
		}   
		return new String(c);   
	}
205783
function _strlen($str) {
        static $mbstring;

        // Cache expensive function_exists() calls.
        if (!isset($mbstring)) {
            $mbstring = function_exists('mb_strwidth');
        }

        if ($mbstring) {
            return mb_strwidth($str, $this->_charset);
        }

        return strlen($str);
    }
1263150
private boolean isLong(final String str) {
		try {
			Long.valueOf(str);
			return true;
		} catch (NumberFormatException e) {
			return false;
		}
	}
967310
public StrBuilder append(final String str) {
        if (str == null) {
            return appendNull();
        }
        final int strLen = str.length();
        if (strLen > 0) {
            final int len = length();
            ensureCapacity(len + strLen);
            str.getChars(0, strLen, buffer, len);
            size += strLen;
        }
        return this;
    }
537750
public static String rtrim(String str, String defaultValue) {
	if (str == null) return defaultValue;
	int len = str.length();

	while ((0 < len) && (str.charAt(len - 1) <= ' ')) {
	    len--;
	}
	return (len < str.length()) ? str.substring(0, len) : str;
    }