
com.harium.suneidesis.linguistic.StringUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
Project to represent knowledge
The newest version!
package com.harium.suneidesis.linguistic;
import java.util.List;
public class StringUtils {
public static String capitalize(String str) {
if (str == null || str.isEmpty()) {
return str;
}
return str.substring(0, 1).toUpperCase() + str.substring(1);
}
public static String join(String delimiter, List words) {
return join(delimiter, delimiter, words);
}
public static String join(String delimiter, String lastDelimiter, List words) {
StringBuilder builder = new StringBuilder();
int i = 0;
for (String scheduleStop : words) {
builder.append(scheduleStop);
if (i < words.size() - 1) {
if (i == words.size() - 2) {
builder.append(lastDelimiter);
} else {
builder.append(delimiter);
}
}
i++;
}
return builder.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy