All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ejlchina.searcher.util.StringUtils Maven / Gradle / Ivy

There is a newer version: 3.8.3
Show newest version
package com.ejlchina.searcher.util;

public class StringUtils {


	public static boolean isBlank(String str) {
		if (str == null) {
			return true;
		}
		int len = str.length();
		if (len == 0) {
			return true;
		}
		for (int i = 0; i < len; i++) {
			switch (str.charAt(i)) {
			case ' ':
			case '\t':
			case '\n':
			case '\r':
				break;
			default:
				return false;
			}
		}
		return true;
	}
	
	public static String firstCharToUpperCase(String string) {
		if (string == null || string.length() == 0) {
			return string;
		}
		char first = string.charAt(0);
		first = (char) (first - 32);
		if (string.length() == 1) {
			return String.valueOf(first);
		}
		return String.valueOf(first) + string.substring(1);
	}
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy