use of tech.tablesaw.api.StringColumn in project symja_android_library by axkr.
the class StringMapFunctions method lowerCase.
default StringColumn lowerCase() {
StringColumn newColumn = StringColumn.create(name() + "[lcase]");
for (int r = 0; r < size(); r++) {
String value = getString(r);
newColumn.append(value.toLowerCase());
}
return newColumn;
}
use of tech.tablesaw.api.StringColumn in project symja_android_library by axkr.
the class StringMapFunctions method replaceAll.
/**
* Creates a new column, replacing each string in this column with a new string formed by
* replacing any substring that matches the regex
*
* @param regexArray the regex array to replace
* @param replacement the replacement array
* @return the new column
*/
default StringColumn replaceAll(String[] regexArray, String replacement) {
StringColumn newColumn = StringColumn.create(name() + "[repl]", this.size());
for (int r = 0; r < size(); r++) {
String value = getString(r);
for (String regex : regexArray) {
value = value.replaceAll(regex, replacement);
}
newColumn.set(r, value);
}
return newColumn;
}
use of tech.tablesaw.api.StringColumn in project symja_android_library by axkr.
the class StringMapFunctions method trim.
default StringColumn trim() {
StringColumn newColumn = StringColumn.create(name() + "[trim]");
for (int r = 0; r < size(); r++) {
String value = getString(r);
newColumn.append(value.trim());
}
return newColumn;
}
use of tech.tablesaw.api.StringColumn in project symja_android_library by axkr.
the class StringMapFunctions method padEnd.
default StringColumn padEnd(int minLength, char padChar) {
StringColumn newColumn = StringColumn.create(name() + "[pad]");
for (int r = 0; r < size(); r++) {
String value = getString(r);
newColumn.append(Strings.padEnd(value, minLength, padChar));
}
return newColumn;
}
use of tech.tablesaw.api.StringColumn in project symja_android_library by axkr.
the class StringMapFunctions method tokenizeAndSort.
/**
* Splits on Whitespace and returns the lexicographically sorted result.
*
* @return a {@link StringColumn}
*/
default StringColumn tokenizeAndSort() {
StringColumn newColumn = StringColumn.create(name() + "[sorted]", this.size());
for (int r = 0; r < size(); r++) {
String value = getString(r);
Splitter splitter = Splitter.on(CharMatcher.whitespace());
splitter = splitter.trimResults();
splitter = splitter.omitEmptyStrings();
List<String> tokens = new ArrayList<>(splitter.splitToList(value));
Collections.sort(tokens);
value = String.join(" ", tokens);
newColumn.set(r, value);
}
return newColumn;
}
Aggregations