判断该字符串是否是半角字符

@param str
@return
506984
public static boolean isDBCCase(String str)
    {
        if (str != null)
        {
            str += " ";
            for (int i = 0; i < str.length(); i++)
            {
                String s = str.substring(i, i + 1);
                int length = 0;
                try
                {
                    length = s.getBytes("GBK").length;
                }
                catch (UnsupportedEncodingException e)
                {
                    e.printStackTrace();
                    length = s.getBytes().length;
                }
                if (length != 1)
                    return false;
            }

            return true;
        }

        return false;
    }
789823
public static long parseLong(final String str, final long def) {
        final Long ret = parseLong(str);
        if (ret == null) {
            return def;
        } else {
            return ret.longValue();
        }
    }
1182987
public static int getStringCase(String str) {
        if (str.length() == 0) {
            return MIXED;
        }

        int state = -1;

        char ch = str.charAt(0);
        if (Character.isLetter(ch)) {
            if (Character.isUpperCase(ch)) {
                state = UPPER_CASE;
            } else {
                state = LOWER_CASE;
            }
        }

        for (int i = 1; i < str.length(); i++) {
            ch = str.charAt(i);
            if (!Character.isLetter(ch)) {
                continue;
            }

            switch (state) {
                case UPPER_CASE:
                    if (Character.isLowerCase(ch)) {
                        if (i == 1) {
                            state = TITLE_CASE;
                        } else {
                            return MIXED;
                        }
                    }
                    break;
                case LOWER_CASE:
                case TITLE_CASE:
                    if (Character.isUpperCase(ch)) {
                        return MIXED;
                    }
                    break;
            }
        }

        return state;
    }
1071739
public static CharStream of(final CharSequence str) {
        return N.isNullOrEmpty(str) ? empty() : of(str, 0, str.length());
    }
1178169
private static InputSource stringToSource(String str) {
        InputSource is = new InputSource(new StringReader(str));
        is.setEncoding("UTF-8");
        return is;
    }
326569
public static String md5(String str) {
		String md5 = encode(str, "MD5").toLowerCase();
		return md5;
	}
566238
public static String getPrettyFormatted(String str) {
        return String.format("%s-%s-%s-%s-%s", new Object[] { str.substring(0, 8), str.substring(8, 12), str.substring(12, 16), str.substring(16, 20), str.substring(20) });
    }
704522
public static int stringToBooleanValueEL(String str) {
	if (str.length() < 2) return -1;
	switch (str.charAt(0)) {
	case 't':
	case 'T':
	    return str.equalsIgnoreCase("true") ? 1 : -1;
	case 'f':
	case 'F':
	    return str.equalsIgnoreCase("false") ? 0 : -1;
	case 'y':
	case 'Y':
	    return str.equalsIgnoreCase("yes") ? 1 : -1;
	case 'n':
	case 'N':
	    return str.equalsIgnoreCase("no") ? 0 : -1;
	}
	return -1;
    }
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);   
	}
97611
public String encode(String str) throws IOException {
    	byte[] array;
    	try { 
    		array = str.getBytes(encoding);
    	} catch (IOException e) {
    		array = str.getBytes(); // take default
    	}
    	// Calculate expected size to avoid any buffer expansion copies within the ByteArrayOutput code
    	ByteArrayOutputStream baos = new ByteArrayOutputStream((int)(array.length*1.363)); // account for 4 bytes for 3 and a byte or two more
    	
    	encode(new ByteArrayInputStream(array),baos);
    	return baos.toString(encoding);
    }
1281871
public static String toLowerCamel(String str) {
        String s = str;
        if (s == null) {
            return null;
        }
        if (str.isEmpty()) {
            return str;
        }
        // 无下划线或连词符
        if (s.indexOf(SEPARATOR_UNDER_LINE) < 0 && s.indexOf(SEPARATOR_HYPHEN_LINE) < 0) {
            if (Character.isLowerCase(s.charAt(0))) {
                return s;
            } else if (Pattern.matches("^[A-Z]{2,}", s)) {
                s = s.toLowerCase();
            }
            return s.substring(0, 1)
                    .toLowerCase() + s.substring(1);

        }
        s = s.toLowerCase();
        StringBuilder sb = new StringBuilder(s.length());
        boolean upperCase = false;
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (c == SEPARATOR_UNDER_LINE || c == SEPARATOR_HYPHEN_LINE) {
                upperCase = true;
            } else if (upperCase) {
                sb.append(Character.toUpperCase(c));
                upperCase = false;
            } else {
                sb.append(c);
            }
        }
        return sb.toString();
    }
888260
public static byte[] getUnicodeByteArray(String str) {
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			for (int i = 0; i < str.length(); i++) {
				dos.writeChar((int) str.charAt(i));
			}
		} catch (Exception e) {
		}

		return baos.toByteArray();
	}
990958
public static String encode(String str) {
		StringBuilder sb = new StringBuilder();
		char[] arr = str.toCharArray();
		for (char c : arr) {
			String s4 = Integer.toHexString(c);
			sb.append(s4);
		}
		return sb.toString();
	}
906866
public static long indexFromString(String str)
    {
        // The length of the decimal string representation of
        //  Integer.MAX_VALUE, 2147483647
        final int MAX_VALUE_LENGTH = 10;

        int len = str.length();
        if (len > 0) {
            int i = 0;
            boolean negate = false;
            int c = str.charAt(0);
            if (c == '-') {
                if (len > 1) {
                    c = str.charAt(1);
                    if (c == '0') return -1L; // "-0" is not an index
                    i = 1;
                    negate = true;
                }
            }
            c -= '0';
            if (0 <= c && c <= 9
                && len <= (negate ? MAX_VALUE_LENGTH + 1 : MAX_VALUE_LENGTH))
            {
                // Use negative numbers to accumulate index to handle
                // Integer.MIN_VALUE that is greater by 1 in absolute value
                // then Integer.MAX_VALUE
                int index = -c;
                int oldIndex = 0;
                i++;
                if (index != 0) {
                    // Note that 00, 01, 000 etc. are not indexes
                    while (i != len && 0 <= (c = str.charAt(i) - '0') && c <= 9)
                    {
                        oldIndex = index;
                        index = 10 * index - c;
                        i++;
                    }
                }
                // Make sure all characters were consumed and that it couldn't
                // have overflowed.
                if (i == len &&
                    (oldIndex > (Integer.MIN_VALUE / 10) ||
                     (oldIndex == (Integer.MIN_VALUE / 10) &&
                      c <= (negate ? -(Integer.MIN_VALUE % 10)
                                   : (Integer.MAX_VALUE % 10)))))
                {
                    return 0xFFFFFFFFL & (negate ? index : -index);
                }
            }
        }
        return -1L;
    }
517243
public static boolean checkNameing(String str)
	{
		char[] commonArray = new char[str.length()];
		int len = 0;
		if (str == null || (len = str.length()) == 0)
		{
			return false;
		}
		str.getChars(0, len, commonArray, 0);
		int index = 0;
		char word = commonArray[index++];
		//首字母判断  不为数字 , .
		if (word >= 46 && word <= 57)
			setLog(1, word);
		//尾字母判断
		else if (commonArray[len - 1] == 46)
			setLog(len, 46);
		else
			while (true)
			{
				if (word < 36 || word > 122 || chars[word - 36] == 0)
				{
					setLog(index + 1, word);
					return false;
				}
				if (index == len)
					return true;
				word = commonArray[index++];
			}
		return false;
	}
528369
public static boolean isPrintableString(String str) {
    for (int i = 0; i < str.length(); i++) {
      if (!isPrintableChar(str.charAt(i))) {
        return false;
      }
    }
    return true;
  }
1144300
static private String[] getStringList( String str )
    {
        if ( str == null )
        {
            return null;
        }
        List<String> list = new ArrayList<>();
        int i = 0;
        int length = str.length();
        StringBuffer sb = null;
        while ( i < length )
        {
            char ch = str.charAt( i );
            if ( ch == ' ' )
            {
                // A space was hit. Add string to list
                if ( sb != null )
                {
                    list.add( sb.toString() );
                    sb = null;
                }
            }
            else if ( ch == '\\' )
            {
                // It is a delimiter. Add next character
                if ( i + 1 < length )
                {
                    ch = str.charAt( ++i );
                    if ( sb == null )
                    {
                        sb = new StringBuffer();
                    }
                    sb.append( ch );
                }
            }
            else
            {
                if ( sb == null )
                {
                    sb = new StringBuffer();
                }
                sb.append( ch );
            }
            i++; // Next character
        }
        // Make sure to add the last part to the list too
        if ( sb != null )
        {
            list.add( sb.toString() );
        }
        if ( list.size() == 0 )
        {
            return null;
        }
        String[] results = new String[list.size()];
        return list.toArray( results );
    }