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

io.github.icodegarden.nutrient.lang.util.StringUtils Maven / Gradle / Ivy

There is a newer version: 3.0.2
Show newest version
package io.github.icodegarden.nutrient.lang.util;

import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 
 * @author Fangfang.Xu
 *
 */
public class StringUtils {
	private static final Pattern TPATTERN = Pattern.compile("[A-Z0-9]");
	
	public static String uuid() {
		return UUID.randomUUID().toString().replace("-", "");
	}

	/**
	 * 驼峰转xxx
	 */
	public static String camelToLower(String str) {
		return camelToLower(str, "");
	}

	/**
	 * 驼峰转xxx
	 */
	public static String camelToLower(String str, String connectStr) {
		Matcher matcher = TPATTERN.matcher(str);
		StringBuilder sb = new StringBuilder();
		while (matcher.find()) {
			matcher.appendReplacement(sb, connectStr + matcher.group(0).toLowerCase());
		}
		matcher.appendTail(sb);
		return sb.toString();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy