package com.qianwen.core.tool.utils;
|
|
import java.io.PrintWriter;
|
import java.io.StringReader;
|
import java.io.StringWriter;
|
import java.text.MessageFormat;
|
import java.util.ArrayList;
|
import java.util.Collection;
|
import java.util.List;
|
import java.util.Map;
|
import java.util.Random;
|
import java.util.UUID;
|
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.regex.Pattern;
|
import java.util.stream.Stream;
|
import com.qianwen.core.tool.support.StrSpliter;
|
import org.springframework.lang.Nullable;
|
import org.springframework.util.Assert;
|
import org.springframework.util.PatternMatchUtils;
|
import org.springframework.util.StringUtils;
|
import org.springframework.web.util.HtmlUtils;
|
|
/* loaded from: blade-core-tool-9.3.0.0-SNAPSHOT.jar:org/springblade/core/tool/utils/StringUtil.class */
|
public class StringUtil extends StringUtils {
|
public static final int INDEX_NOT_FOUND = -1;
|
private static final Pattern SPECIAL_CHARS_REGEX = Pattern.compile("[`'\"|/,;()-+*%#·•�\u3000\\s]");
|
|
public static String throwable2String(Throwable e) {
|
StringWriter writer = new StringWriter();
|
e.printStackTrace(new PrintWriter(writer));
|
return writer.toString();
|
}
|
|
public static String concat(Object... more) {
|
return concatSpiltWith(StringPool.EMPTY, more);
|
}
|
|
public static String concatSpiltWith(String split, Object... more) {
|
StringBuilder buf = new StringBuilder();
|
for (int i = 0; i < more.length; i++) {
|
if (i != 0) {
|
buf.append(split);
|
}
|
buf.append(more[i]);
|
}
|
return buf.toString();
|
}
|
|
public static boolean isBlank(final CharSequence cs) {
|
return !hasText(cs);
|
}
|
|
public static boolean isNotBlank(final CharSequence cs) {
|
return hasText(cs);
|
}
|
|
public static boolean isAnyBlank(final CharSequence... css) {
|
if (ObjectUtil.isEmpty(css)) {
|
return true;
|
}
|
return Stream.<CharSequence>of(css).anyMatch(StringUtil::isBlank);
|
|
}
|
|
public static boolean isNoneBlank(final CharSequence... css) {
|
if (ObjectUtil.isEmpty(css)) {
|
return false;
|
}
|
|
return Stream.<CharSequence>of(css).allMatch(StringUtil::isNotBlank);
|
//return Stream.of((Object[]) css).allMatch(StringUtil::isNotBlank);
|
}
|
|
public static boolean isAllBlank(final CharSequence... css) {
|
//return Stream.of((Object[]) css).allMatch(StringUtil::isBlank);
|
return Stream.<CharSequence>of(css).allMatch(StringUtil::isBlank);
|
}
|
|
public static boolean isNumeric(final CharSequence cs) {
|
int chr;
|
if (isBlank(cs)) {
|
return false;
|
}
|
int i = cs.length();
|
do {
|
i--;
|
if (i >= 0) {
|
chr = cs.charAt(i);
|
if (chr < 48) {
|
return false;
|
}
|
} else {
|
return true;
|
}
|
} while (chr <= 57);
|
return false;
|
}
|
|
public static String format(@Nullable String message, @Nullable Map<String, ?> params) {
|
int cursor;
|
int end;
|
if (message == null) {
|
return StringPool.EMPTY;
|
}
|
if (params == null || params.isEmpty()) {
|
return message;
|
}
|
StringBuilder sb = new StringBuilder((int) (message.length() * 1.5d));
|
int i = 0;
|
while (true) {
|
cursor = i;
|
int start = message.indexOf("${", cursor);
|
if (start == -1 || (end = message.indexOf("}", start)) == -1) {
|
break;
|
}
|
sb.append((CharSequence) message, cursor, start);
|
String key = message.substring(start + 2, end);
|
Object value = params.get(trimWhitespace(key));
|
sb.append(value == null ? StringPool.EMPTY : value);
|
i = end + 1;
|
}
|
sb.append(message.substring(cursor));
|
return sb.toString();
|
}
|
|
public static String format(@Nullable String message, @Nullable Object... arguments) {
|
int end;
|
if (message == null) {
|
return StringPool.EMPTY;
|
}
|
if (arguments == null || arguments.length == 0) {
|
return message;
|
}
|
StringBuilder sb = new StringBuilder((int) (message.length() * 1.5d));
|
int cursor = 0;
|
int index = 0;
|
int argsLength = arguments.length;
|
while (true) {
|
int start = message.indexOf(CharPool.LEFT_BRACE, cursor);
|
if (start == -1 || (end = message.indexOf(CharPool.RIGHT_BRACE, start)) == -1 || index >= argsLength) {
|
break;
|
}
|
sb.append((CharSequence) message, cursor, start);
|
sb.append(arguments[index]);
|
cursor = end + 1;
|
index++;
|
}
|
sb.append(message.substring(cursor));
|
return sb.toString();
|
}
|
|
public static String format(long nanos) {
|
if (nanos < 1) {
|
return "0ms";
|
}
|
double millis = nanos / 1000000.0d;
|
if (millis > 1000.0d) {
|
return String.format("%.3fs", Double.valueOf(millis / 1000.0d));
|
}
|
return String.format("%.3fms", Double.valueOf(millis));
|
}
|
|
public static String join(Collection<?> coll) {
|
return collectionToCommaDelimitedString(coll);
|
}
|
|
public static String join(Collection<?> coll, String delim) {
|
return collectionToDelimitedString(coll, delim);
|
}
|
|
public static String join(Object[] arr) {
|
return arrayToCommaDelimitedString(arr);
|
}
|
|
public static String join(Object[] arr, String delim) {
|
return arrayToDelimitedString(arr, delim);
|
}
|
|
public static boolean simpleMatch(@Nullable String pattern, @Nullable String str) {
|
return PatternMatchUtils.simpleMatch(pattern, str);
|
}
|
|
public static boolean simpleMatch(@Nullable String[] patterns, String str) {
|
return PatternMatchUtils.simpleMatch(patterns, str);
|
}
|
|
public static String randomUUID() {
|
ThreadLocalRandom random = ThreadLocalRandom.current();
|
return new UUID(random.nextLong(), random.nextLong()).toString().replace(StringPool.DASH, StringPool.EMPTY);
|
}
|
|
public static String escapeHtml(String html) {
|
return isBlank(html) ? StringPool.EMPTY : HtmlUtils.htmlEscape(html);
|
}
|
|
public static String cleanChars(String txt) {
|
return txt.replaceAll("[ \u3000`·•�\u0001\\f\\t\\v\\s]", StringPool.EMPTY);
|
}
|
|
@Nullable
|
public static String cleanText(@Nullable String txt) {
|
if (txt == null) {
|
return null;
|
}
|
return SPECIAL_CHARS_REGEX.matcher(txt).replaceAll(StringPool.EMPTY);
|
}
|
|
@Nullable
|
public static String cleanIdentifier(@Nullable String param) {
|
if (param == null) {
|
return null;
|
}
|
StringBuilder paramBuilder = new StringBuilder();
|
for (int i = 0; i < param.length(); i++) {
|
char c = param.charAt(i);
|
if (Character.isJavaIdentifierPart(c)) {
|
paramBuilder.append(c);
|
}
|
}
|
return paramBuilder.toString();
|
}
|
|
public static String random(int count) {
|
return random(count, RandomType.ALL);
|
}
|
|
public static String random(int count, RandomType randomType) {
|
if (count == 0) {
|
return StringPool.EMPTY;
|
}
|
Assert.isTrue(count > 0, "Requested random string length " + count + " is less than 0.");
|
Random random = Holder.SECURE_RANDOM;
|
char[] buffer = new char[count];
|
for (int i = 0; i < count; i++) {
|
String factor = randomType.getFactor();
|
buffer[i] = factor.charAt(random.nextInt(factor.length()));
|
}
|
return new String(buffer);
|
}
|
|
public static String indexedFormat(CharSequence pattern, Object... arguments) {
|
return MessageFormat.format(pattern.toString(), arguments);
|
}
|
|
public static String format(CharSequence template, Map<?, ?> map) {
|
if (null == template) {
|
return null;
|
}
|
if (null == map || map.isEmpty()) {
|
return template.toString();
|
}
|
String template2 = template.toString();
|
for (Map.Entry<?, ?> entry : map.entrySet()) {
|
template2 = template2.replace(StringPool.LEFT_BRACE + entry.getKey() + "}", Func.toStr(entry.getValue()));
|
}
|
return template2;
|
}
|
|
public static List<String> split(CharSequence str, char separator, int limit) {
|
return split(str, separator, limit, false, false);
|
}
|
|
public static String[] splitTrim(@Nullable String str, @Nullable String delimiter) {
|
return delimitedListToStringArray(str, delimiter, " \t\n\n\f");
|
}
|
|
public static List<String> splitTrim(CharSequence str, char separator) {
|
return splitTrim(str, separator, -1);
|
}
|
|
public static List<String> splitTrim(CharSequence str, CharSequence separator) {
|
return splitTrim(str, separator, -1);
|
}
|
|
public static List<String> splitTrim(CharSequence str, char separator, int limit) {
|
return split(str, separator, limit, true, true);
|
}
|
|
public static List<String> splitTrim(CharSequence str, CharSequence separator, int limit) {
|
return split(str, separator, limit, true, true);
|
}
|
|
public static List<String> split(CharSequence str, char separator, boolean isTrim, boolean ignoreEmpty) {
|
return split(str, separator, 0, isTrim, ignoreEmpty);
|
}
|
|
public static List<String> split(CharSequence str, char separator, int limit, boolean isTrim, boolean ignoreEmpty) {
|
if (null == str) {
|
return new ArrayList(0);
|
}
|
return StrSpliter.split(str.toString(), separator, limit, isTrim, ignoreEmpty);
|
}
|
|
public static List<String> split(CharSequence str, CharSequence separator, int limit, boolean isTrim, boolean ignoreEmpty) {
|
if (null == str) {
|
return new ArrayList(0);
|
}
|
String separatorStr = null == separator ? null : separator.toString();
|
return StrSpliter.split(str.toString(), separatorStr, limit, isTrim, ignoreEmpty);
|
}
|
|
public static String[] split(CharSequence str, CharSequence separator) {
|
if (str == null) {
|
return new String[0];
|
}
|
String separatorStr = null == separator ? null : separator.toString();
|
return StrSpliter.splitToArray(str.toString(), separatorStr, 0, false, false);
|
}
|
|
public static String[] split(CharSequence str, int len) {
|
if (null == str) {
|
return new String[0];
|
}
|
return StrSpliter.splitByLength(str.toString(), len);
|
}
|
|
public static boolean contains(CharSequence str, char searchChar) {
|
return indexOf(str, searchChar) > -1;
|
}
|
|
public static boolean containsAny(CharSequence str, CharSequence... testStrs) {
|
return null != getContainsStr(str, testStrs);
|
}
|
|
public static String getContainsStr(CharSequence str, CharSequence... testStrs) {
|
if (isEmpty(str) || Func.isEmpty((Object[]) testStrs)) {
|
return null;
|
}
|
for (CharSequence checkStr : testStrs) {
|
if (str.toString().contains(checkStr)) {
|
return checkStr.toString();
|
}
|
}
|
return null;
|
}
|
|
public static boolean containsIgnoreCase(CharSequence str, CharSequence testStr) {
|
if (null == str) {
|
return null == testStr;
|
}
|
return str.toString().toLowerCase().contains(testStr.toString().toLowerCase());
|
}
|
|
public static boolean containsAnyIgnoreCase(CharSequence str, CharSequence... testStrs) {
|
return null != getContainsStrIgnoreCase(str, testStrs);
|
}
|
|
public static String getContainsStrIgnoreCase(CharSequence str, CharSequence... testStrs) {
|
if (isEmpty(str) || Func.isEmpty((Object[]) testStrs)) {
|
return null;
|
}
|
for (CharSequence testStr : testStrs) {
|
if (containsIgnoreCase(str, testStr)) {
|
return testStr.toString();
|
}
|
}
|
return null;
|
}
|
|
public static String sub(CharSequence str, int fromIndex, int toIndex) {
|
if (isEmpty(str)) {
|
return StringPool.EMPTY;
|
}
|
int len = str.length();
|
if (fromIndex < 0) {
|
fromIndex = len + fromIndex;
|
if (fromIndex < 0) {
|
fromIndex = 0;
|
}
|
} else if (fromIndex > len) {
|
fromIndex = len;
|
}
|
if (toIndex < 0) {
|
toIndex = len + toIndex;
|
if (toIndex < 0) {
|
toIndex = len;
|
}
|
} else if (toIndex > len) {
|
toIndex = len;
|
}
|
if (toIndex < fromIndex) {
|
int tmp = fromIndex;
|
fromIndex = toIndex;
|
toIndex = tmp;
|
}
|
if (fromIndex == toIndex) {
|
return StringPool.EMPTY;
|
}
|
return str.toString().substring(fromIndex, toIndex);
|
}
|
|
public static String subBefore(CharSequence string, CharSequence separator, boolean isLastSeparator) {
|
if (isEmpty(string) || separator == null) {
|
if (null == string) {
|
return null;
|
}
|
return string.toString();
|
}
|
String str = string.toString();
|
String sep = separator.toString();
|
if (sep.isEmpty()) {
|
return StringPool.EMPTY;
|
}
|
int pos = isLastSeparator ? str.lastIndexOf(sep) : str.indexOf(sep);
|
if (pos == -1) {
|
return str;
|
}
|
return str.substring(0, pos);
|
}
|
|
public static String subAfter(CharSequence string, CharSequence separator, boolean isLastSeparator) {
|
if (isEmpty(string)) {
|
if (null == string) {
|
return null;
|
}
|
return string.toString();
|
} else if (separator == null) {
|
return StringPool.EMPTY;
|
} else {
|
String str = string.toString();
|
String sep = separator.toString();
|
int pos = isLastSeparator ? str.lastIndexOf(sep) : str.indexOf(sep);
|
if (pos == -1) {
|
return StringPool.EMPTY;
|
}
|
return str.substring(pos + separator.length());
|
}
|
}
|
|
public static String subBetween(CharSequence str, CharSequence before, CharSequence after) {
|
int end;
|
if (str == null || before == null || after == null) {
|
return null;
|
}
|
String str2 = str.toString();
|
String before2 = before.toString();
|
String after2 = after.toString();
|
int start = str2.indexOf(before2);
|
if (start != -1 && (end = str2.indexOf(after2, start + before2.length())) != -1) {
|
return str2.substring(start + before2.length(), end);
|
}
|
return null;
|
}
|
|
public static String subBetween(CharSequence str, CharSequence beforeAndAfter) {
|
return subBetween(str, beforeAndAfter, beforeAndAfter);
|
}
|
|
public static String removePrefix(CharSequence str, CharSequence prefix) {
|
if (isEmpty(str) || isEmpty(prefix)) {
|
return StringPool.EMPTY;
|
}
|
String str2 = str.toString();
|
if (str2.startsWith(prefix.toString())) {
|
return subSuf(str2, prefix.length());
|
}
|
return str2;
|
}
|
|
public static String removePrefixIgnoreCase(CharSequence str, CharSequence prefix) {
|
if (isEmpty(str) || isEmpty(prefix)) {
|
return StringPool.EMPTY;
|
}
|
String str2 = str.toString();
|
if (str2.toLowerCase().startsWith(prefix.toString().toLowerCase())) {
|
return subSuf(str2, prefix.length());
|
}
|
return str2;
|
}
|
|
public static String removeSuffix(CharSequence str, CharSequence suffix) {
|
if (isEmpty(str) || isEmpty(suffix)) {
|
return StringPool.EMPTY;
|
}
|
String str2 = str.toString();
|
if (str2.endsWith(suffix.toString())) {
|
return subPre(str2, str2.length() - suffix.length());
|
}
|
return str2;
|
}
|
|
public static String removeSufAndLowerFirst(CharSequence str, CharSequence suffix) {
|
return firstCharToLower(removeSuffix(str, suffix));
|
}
|
|
public static String removeSuffixIgnoreCase(CharSequence str, CharSequence suffix) {
|
if (isEmpty(str) || isEmpty(suffix)) {
|
return StringPool.EMPTY;
|
}
|
String str2 = str.toString();
|
if (str2.toLowerCase().endsWith(suffix.toString().toLowerCase())) {
|
return subPre(str2, str2.length() - suffix.length());
|
}
|
return str2;
|
}
|
|
public static String firstCharToLower(String str) {
|
char firstChar = str.charAt(0);
|
if (firstChar >= 'A' && firstChar <= 'Z') {
|
char[] arr = str.toCharArray();
|
arr[0] = (char) (arr[0] + ' ');
|
return new String(arr);
|
}
|
return str;
|
}
|
|
public static String firstCharToUpper(String str) {
|
char firstChar = str.charAt(0);
|
if (firstChar >= 'a' && firstChar <= 'z') {
|
char[] arr = str.toCharArray();
|
arr[0] = (char) (arr[0] - ' ');
|
return new String(arr);
|
}
|
return str;
|
}
|
|
public static String subPre(CharSequence string, int toIndex) {
|
return sub(string, 0, toIndex);
|
}
|
|
public static String subSuf(CharSequence string, int fromIndex) {
|
if (isEmpty(string)) {
|
return null;
|
}
|
return sub(string, fromIndex, string.length());
|
}
|
|
public static int indexOf(final CharSequence str, char searchChar) {
|
return indexOf(str, searchChar, 0);
|
}
|
|
public static int indexOf(final CharSequence str, char searchChar, int start) {
|
if (str instanceof String) {
|
return ((String) str).indexOf(searchChar, start);
|
}
|
return indexOf(str, searchChar, start, -1);
|
}
|
|
public static int indexOf(final CharSequence str, char searchChar, int start, int end) {
|
int len = str.length();
|
start = (start < 0 || start > len) ? 0 : 0;
|
if (end > len || end < 0) {
|
end = len;
|
}
|
for (int i = start; i < end; i++) {
|
if (str.charAt(i) == searchChar) {
|
return i;
|
}
|
}
|
return -1;
|
}
|
|
public static int indexOfIgnoreCase(final CharSequence str, final CharSequence searchStr) {
|
return indexOfIgnoreCase(str, searchStr, 0);
|
}
|
|
public static int indexOfIgnoreCase(final CharSequence str, final CharSequence searchStr, int fromIndex) {
|
return indexOf(str, searchStr, fromIndex, true);
|
}
|
|
public static int indexOf(final CharSequence str, CharSequence searchStr, int fromIndex, boolean ignoreCase) {
|
if (str == null || searchStr == null) {
|
return -1;
|
}
|
if (fromIndex < 0) {
|
fromIndex = 0;
|
}
|
int endLimit = (str.length() - searchStr.length()) + 1;
|
if (fromIndex > endLimit) {
|
return -1;
|
}
|
if (searchStr.length() == 0) {
|
return fromIndex;
|
}
|
if (false == ignoreCase) {
|
return str.toString().indexOf(searchStr.toString(), fromIndex);
|
}
|
for (int i = fromIndex; i < endLimit; i++) {
|
if (isSubEquals(str, i, searchStr, 0, searchStr.length(), true)) {
|
return i;
|
}
|
}
|
return -1;
|
}
|
|
public static int lastIndexOfIgnoreCase(final CharSequence str, final CharSequence searchStr) {
|
return lastIndexOfIgnoreCase(str, searchStr, str.length());
|
}
|
|
public static int lastIndexOfIgnoreCase(final CharSequence str, final CharSequence searchStr, int fromIndex) {
|
return lastIndexOf(str, searchStr, fromIndex, true);
|
}
|
|
public static int lastIndexOf(final CharSequence str, final CharSequence searchStr, int fromIndex, boolean ignoreCase) {
|
if (str == null || searchStr == null) {
|
return -1;
|
}
|
if (fromIndex < 0) {
|
fromIndex = 0;
|
}
|
int fromIndex2 = Math.min(fromIndex, str.length());
|
if (searchStr.length() == 0) {
|
return fromIndex2;
|
}
|
if (false == ignoreCase) {
|
return str.toString().lastIndexOf(searchStr.toString(), fromIndex2);
|
}
|
for (int i = fromIndex2; i > 0; i--) {
|
if (isSubEquals(str, i, searchStr, 0, searchStr.length(), true)) {
|
return i;
|
}
|
}
|
return -1;
|
}
|
|
public static int ordinalIndexOf(String str, String searchStr, int ordinal) {
|
if (str == null || searchStr == null || ordinal <= 0) {
|
return -1;
|
}
|
if (searchStr.length() == 0) {
|
return 0;
|
}
|
int found = 0;
|
int index = -1;
|
do {
|
index = str.indexOf(searchStr, index + 1);
|
if (index < 0) {
|
return index;
|
}
|
found++;
|
} while (found < ordinal);
|
return index;
|
}
|
|
public static boolean isSubEquals(CharSequence str1, int start1, CharSequence str2, int start2, int length, boolean ignoreCase) {
|
if (null == str1 || null == str2) {
|
return false;
|
}
|
return str1.toString().regionMatches(ignoreCase, start1, str2.toString(), start2, length);
|
}
|
|
public static boolean equals(CharSequence str1, CharSequence str2) {
|
return equals(str1, str2, false);
|
}
|
|
public static boolean equalsIgnoreCase(CharSequence str1, CharSequence str2) {
|
return equals(str1, str2, true);
|
}
|
|
public static boolean equals(CharSequence str1, CharSequence str2, boolean ignoreCase) {
|
if (null == str1) {
|
return str2 == null;
|
} else if (null == str2) {
|
return false;
|
} else {
|
if (ignoreCase) {
|
return str1.toString().equalsIgnoreCase(str2.toString());
|
}
|
return str1.equals(str2);
|
}
|
}
|
|
public static StringBuilder builder() {
|
return new StringBuilder();
|
}
|
|
public static StringBuilder builder(int capacity) {
|
return new StringBuilder(capacity);
|
}
|
|
public static StringBuilder builder(CharSequence... strs) {
|
StringBuilder sb = new StringBuilder();
|
for (CharSequence str : strs) {
|
sb.append(str);
|
}
|
return sb;
|
}
|
|
public static StringBuilder appendBuilder(StringBuilder sb, CharSequence... strs) {
|
for (CharSequence str : strs) {
|
sb.append(str);
|
}
|
return sb;
|
}
|
|
public static StringReader getReader(CharSequence str) {
|
if (null == str) {
|
return null;
|
}
|
return new StringReader(str.toString());
|
}
|
|
public static StringWriter getWriter() {
|
return new StringWriter();
|
}
|
|
public static int count(CharSequence content, CharSequence strForSearch) {
|
if (Func.hasEmpty(content, strForSearch) || strForSearch.length() > content.length()) {
|
return 0;
|
}
|
int count = 0;
|
int idx = 0;
|
String content2 = content.toString();
|
String strForSearch2 = strForSearch.toString();
|
while (true) {
|
int idx2 = content2.indexOf(strForSearch2, idx);
|
if (idx2 > -1) {
|
count++;
|
idx = idx2 + strForSearch.length();
|
} else {
|
return count;
|
}
|
}
|
}
|
|
public static int count(CharSequence content, char charForSearch) {
|
int count = 0;
|
if (isEmpty(content)) {
|
return 0;
|
}
|
int contentLength = content.length();
|
for (int i = 0; i < contentLength; i++) {
|
if (charForSearch == content.charAt(i)) {
|
count++;
|
}
|
}
|
return count;
|
}
|
|
public static String underlineToHump(String para) {
|
StringBuilder result = new StringBuilder();
|
String[] a = para.split(StringPool.UNDERSCORE);
|
for (String s : a) {
|
if (result.length() == 0) {
|
result.append(s.toLowerCase());
|
} else {
|
result.append(s.substring(0, 1).toUpperCase());
|
result.append(s.substring(1).toLowerCase());
|
}
|
}
|
return result.toString();
|
}
|
|
public static String humpToUnderline(String para) {
|
String para2 = firstCharToLower(para);
|
StringBuilder sb = new StringBuilder(para2);
|
int temp = 0;
|
for (int i = 0; i < para2.length(); i++) {
|
if (Character.isUpperCase(para2.charAt(i))) {
|
sb.insert(i + temp, StringPool.UNDERSCORE);
|
temp++;
|
}
|
}
|
return sb.toString().toLowerCase();
|
}
|
|
public static String lineToHump(String para) {
|
StringBuilder result = new StringBuilder();
|
String[] a = para.split(StringPool.DASH);
|
for (String s : a) {
|
if (result.length() == 0) {
|
result.append(s.toLowerCase());
|
} else {
|
result.append(s.substring(0, 1).toUpperCase());
|
result.append(s.substring(1).toLowerCase());
|
}
|
}
|
return result.toString();
|
}
|
|
public static String humpToLine(String para) {
|
String para2 = firstCharToLower(para);
|
StringBuilder sb = new StringBuilder(para2);
|
int temp = 0;
|
for (int i = 0; i < para2.length(); i++) {
|
if (Character.isUpperCase(para2.charAt(i))) {
|
sb.insert(i + temp, StringPool.DASH);
|
temp++;
|
}
|
}
|
return sb.toString().toLowerCase();
|
}
|
}
|