//ERDDAP/com.cohort.util/ScriptString2
ScriptString2
[JVM]
open class ScriptString2
This class makes about half of the static methods in com.cohort.String2 accessible to JexlScript scripts as "String2.name()" methods. All of the constants and methods related to files, system information, ArrayList, Enumeration, Vector, BitSet, Map, interactive computing, etc., are not included here.
The underlying String2 class is Copyright (c) 2005 Robert Simons (CoHortSoftware@gmail.com). See the MIT/X-like license in com/cohort/util/LICENSE.txt.
Author
Bob Simons (was bob.simons@noaa.gov, now BobSimons2.00@gmail.com) 2019-11-14
Constructors
ScriptString2 | [JVM] constructor() |
Functions
Name | Summary |
---|---|
allDigits | [JVM] fun allDigits(s: String): Boolean 0..9. |
annotatedString | [JVM] open fun annotatedString(s: String): String This converts non-isPrintable characters to "[#]". |
arrayToCSSVString | [JVM] open fun arrayToCSSVString(value: Any): String This returns a nice String representation of the attribute value (which should be a String or an array of primitives). |
binaryFindClosest | [JVM] open fun binaryFindClosest(sar: Array<String>, s: String): Int Find the closest element to s in an ascending sorted array. |
binaryFindFirstGE | [JVM] open fun binaryFindFirstGE(sar: Array<String>, s: String): Int Find the first element which is >= s in an ascending sorted array. |
binaryFindLastLE | [JVM] open fun binaryFindLastLE(sar: Array<String>, s: String): Int Find the last element which is <= s in an ascending sorted array. |
camelCaseToTitleCase | [JVM] open fun camelCaseToTitleCase(s: String): String This converts "camelCase99String" to "Camel Case 99 String" |
caseInsensitiveIndexOf | [JVM] open fun caseInsensitiveIndexOf(ar: Array<Any>, s: String): Int This finds the first element in Object[] where ar[i].toString().toLowerCase() equals to s.toLowerCase(). |
center | [JVM] open fun center(s: String, length: Int): String Returns a String 'length' long, with 's' centered (using spaces as the added characters) within the resulting String. |
charToJsonString | [JVM] open fun charToJsonString(ch: Char, firstUEncodedChar: Int, encodeNewline: Boolean): String This encodes one char to the Json encoding. |
combineSpaces | [JVM] open fun combineSpaces(s: String): String Returns a string where all cases of more than one space are replaced by one space. |
commonUnicodeToPlainText | [JVM] open fun commonUnicodeToPlainText(s: String): String |
countAll | [JVM] open fun countAll(s: String, findS: Char): Int open fun countAll(s: String, findS: String): Int This counts all occurrences of findS in s. |
csvToDoubleArray | [JVM] open fun csvToDoubleArray(csv: String): Array<Double> This converts a comma-separated-value String into a double[]. |
csvToIntArray | [JVM] open fun csvToIntArray(csv: String): Array<Int> This converts a comma-separated-value String into an int[]. |
differentLine | [JVM] open fun differentLine(oldS: String, newS: String): String Given two strings with internal newlines, oldS and newS, this a message indicating where they differ. |
encodeFileNameSafe | [JVM] open fun encodeFileNameSafe(s: String): String This is different from String2.modifyToBeFileNameSafe -- this encodes non-fileNameSafe characters so little or no information is lost. |
encodeMatlabNameSafe | [JVM] open fun encodeMatlabNameSafe(s: String): String This is like encodeFileNameSafe, but further restricts the name to - first character must be A-Z, a-z. - subsequent characters must be A-Z, a-z, _, 0-9. 'x' and non-safe characters are CONVERTED to 'x' plus their 2 lowercase hexadecimalDigit number or "xx" + their 4 hexadecimalDigit number. |
extractAllCaptureGroupsAsStringArray | [JVM] open fun extractAllCaptureGroupsAsStringArray(s: String, regex: String, captureGroupNumber: Int): Array<String> This repeatedly finds the regex and extracts the specified captureGroup. |
extractAllRegexes | [JVM] open fun extractAllRegexes(s: String, regex: String): Array<String> This returns all the sections of s that match regex. |
extractCaptureGroup | [JVM] open fun extractCaptureGroup(s: String, regex: String, captureGroupNumber: Int): String This returns the specified capture group from s. |
extractRegex | [JVM] open fun extractRegex(s: String, regex: String, fromIndex: Int): String This returns the first section of s (starting at fromIndex) which matches regex. |
findInvalidUnicode | [JVM] open fun findInvalidUnicode(s: String, alsoOK: String): Int This returns the index of the first non-Unicode character. |
findNth | [JVM] open fun findNth(s: String, findS: Char, nth: Int): Int This returns the index of the nth occurrence of findS in s. |
findPrefix | [JVM] open fun findPrefix(prefixes: Array<String>, longerString: String, startAt: Int): String This is like whichPrefix, but returns the found prefix (or null). |
findWholeWord | [JVM] open fun findWholeWord(s: String, word: String): Int This finds (case-sensitive) the first whole word instance of 'word' in s. |
fromJson | [JVM] open fun fromJson(s: String): String This returns the unJSON version of a JSON string (surrounding "'s (if any) are removed and \, \f, \n, \r, \t, /, and " are unescaped). |
fromJsonNotNull | [JVM] open fun fromJsonNotNull(s: String): String This is like the other fromJson, but returns "" instead of null. |
fromNccsvChar | [JVM] open fun fromNccsvChar(s: String): Char This converts an NCCSV encoded char to a true char (surrounding "'s and ''s (if any) are removed and \, \f, \n, \r, \t, /, and " are unescaped). |
fromNccsvString | [JVM] open fun fromNccsvString(s: String): String This converts an NCCSV string to a true string (surrounding "'s (if any) are removed and \, \f, \n, \r, \t, /, and " are unescaped). |
genEFormat10 | [JVM] open fun genEFormat10(d: Double): String This returns the number formatted with up to 10 digits to the left and right of the decimal and trailing decimal 0's removed. |
genEFormat6 | [JVM] open fun genEFormat6(d: Double): String This returns the number formatted with up to 6 digits to the left and right of the decimal and trailing decimal 0's removed. |
genHTMLFormat10 | [JVM] open fun genHTMLFormat10(d: Double): String This is like genEFormat10, but the scientific notation format is, e.g., 8. |
genHTMLFormat6 | [JVM] open fun genHTMLFormat6(d: Double): String This is like genEFormat6, but the scientific notation format is, e.g., 8. |
genX10Format10 | [JVM] open fun genX10Format10(d: Double): String This is like genEFormat10, but the scientific notation format is, e.g., 8.9509484321x10^-5. |
genX10Format6 | [JVM] open fun genX10Format6(d: Double): String This is like genEFormat6, but the scientific notation format is, e.g., 8.954321x10^-5. |
getNMatchingCharacters | [JVM] open fun getNMatchingCharacters(s1: String, s2: String): Int This determines the number of initial characters that match. |
ifJsonFromJson | [JVM] open fun ifJsonFromJson(s: String): String If the String is surrounded by ", this returns fromJson(s), else it returns s. |
ifSomethingConcat | [JVM] open fun ifSomethingConcat(a: String, separator: String, b: String): String This cleverly concatenates the 2 strings (with separator, as appropriate). |
indexOf | [JVM] open fun indexOf(cArray: Array<Char>, c: Char): Int Finds the first instance of c in cArray. [JVM] open fun indexOf(dArray: Array<Double>, d: Double): Int Finds the first instance of d in dArray (tested with Math2.almostEqual5). [JVM] open fun indexOf(iArray: Array<Int>, i: Int): Int Finds the first instance of i in iArray. [JVM] open fun indexOf(ar: Array<Any>, s: String): Int This finds the first element in Object[] where the ar[i].toString value equals to s. [JVM] open fun indexOf(cArray: Array<Char>, c: Char, fromIndex: Int): Int Finds the first instance of c at or after fromIndex (0.. [JVM] open fun indexOf(dArray: Array<Double>, d: Double, fromIndex: Int): Int Finds the first instance of d at or after fromIndex (0.. [JVM] open fun indexOf(iArray: Array<Int>, i: Int, fromIndex: Int): Int Finds the first instance of i at or after fromIndex (0.. [JVM] open fun indexOf(ar: Array<Any>, s: String, startAt: Int): Int This finds the first element in Object[] (starting at element startAt) where the ar[i].toString value equals s. [JVM] open fun indexOf(s: String, car: String, fromIndex: Int): Int This indexOf is a little different: it finds the first instance in s of any char in car. |
indexOfChar | [JVM] open fun indexOfChar(s: String, car: Array<Char>, fromIndex: Int): Int This indexOf is a little different: it finds the first instance in s of any char in car. |
indexOfIgnoreCase | [JVM] open fun indexOfIgnoreCase(s: String, find: String): Int open fun indexOfIgnoreCase(s: String, find: String, fromIndex: Int): Int Finds the first instance of 'find' at or after fromIndex (0..), ignoring case. |
indexOfObject | [JVM] open fun indexOfObject(ar: Array<Any>, o: Any): Int A variant of indexOfObject() that uses startAt=0. [JVM] open fun indexOfObject(ar: Array<Any>, o: Any, startAt: Int): Int This finds the first element in Object[] (starting at element startAt) where ar[i]==o. |
isAsciiLetter | [JVM] fun isAsciiLetter(c: Int): Boolean This returns true for A..Z, a..z. |
isAsciiPrintable | [JVM] fun isAsciiPrintable(ch: Int): Boolean returns true if ch is 32..126. [JVM] fun isAsciiPrintable(s: String): Boolean Returns true if all of the characters in s are 32.. |
isDigit | [JVM] fun isDigit(c: Int): Boolean 0..9. |
isDigitLetter | [JVM] fun isDigitLetter(c: Int): Boolean Determines if the character is a digit or a letter. |
isEmailAddress | [JVM] open fun isEmailAddress(email: String): Boolean This indicates if 'email' is a valid email address. |
isFileNameSafe | [JVM] open fun isFileNameSafe(ch: Char): Boolean This indicates if ch is a file-name-safe character (A-Z, a-z, 0-9, _, -, or .). [JVM] open fun isFileNameSafe(s: String): Boolean This indicates if s has length >= 1 and has just file-name-safe characters (0-9, A-Z, a-z, _, -, .). |
isHexDigit | [JVM] fun isHexDigit(c: Int): Boolean 0..9, a..f, A..F Hex numbers are 0x followed by hexDigits. |
isHexString | [JVM] fun isHexString(s: String): Boolean Returns true if all of the characters in s are hex digits. |
isIDFirstLetter | [JVM] fun isIDFirstLetter(c: Int): Boolean First letters for identifiers (e.g., variable names, method names) can be all isLetter()'s plus $ and _. |
isIso8859 | [JVM] open fun isIso8859(s: String): Boolean This returns true if the string contains only ISO 8859-1 characters (i.e., 0 - 255). |
isJsonpNameSafe | [JVM] open fun isJsonpNameSafe(s: String): Boolean This tests if s is a valid jsonp function name. |
isLetter | [JVM] fun isLetter(c: Int): Boolean This includes hiASCII/ISO Latin 1/ISO 8859-1, but not extensive unicode characters. |
isNumber | [JVM] fun isNumber(s: String): Boolean This tries to quickly determine if the string is a correctly formatted number (including decimal, hexadecimal, octal, and "NaN" (any case)). |
isPrintable | [JVM] fun isPrintable(ch: Int): Boolean This indicates if ch is printable with System.err.println() and Graphics.drawString(); hence, it is a subset of 0..255. [JVM] fun isPrintable(s: String): Boolean Returns true if all of the characters in s are printable |
isRemote | [JVM] open fun isRemote(dir: String): Boolean This returns true if the dir starts with http://, https://, ftp://, sftp://, or smb://. |
isSomething | [JVM] open fun isSomething(s: String): Boolean This returns true if s isn't null and s.trim(). |
isSomething2 | [JVM] open fun isSomething2(s: String): Boolean This returns true if s isn't null, "", "-", "null", "nd", "N/A", "...", "???", etc. |
isTrulyRemote | [JVM] open fun isTrulyRemote(dir: String): Boolean This returns true if the dir starts with http://, https://, ftp://, sftp://, or smb://, but not if it's an AWS S3 URL. |
isUrl | [JVM] open fun isUrl(url: String): Boolean This indicates if 'url' is probably a valid url. |
isVariableNameSafe | [JVM] open fun isVariableNameSafe(s: String): Boolean This tests if s is a valid variableName: - first character must be (iso8859Letter |
isWhite | [JVM] fun isWhite(c: Int): Boolean Whitespace characters are u0001 .. |
justFiniteValues | [JVM] open fun justFiniteValues(dar: Array<Double>): Array<Double> This returns a double[] with just the finite values from the original array. [JVM] open fun justFiniteValues(iar: Array<Int>): Array<Int> This returns an int[] with just the non-Integer.MAX_VALUE values from the original array. |
justPrintable | [JVM] open fun justPrintable(s: String): String This returns the string with all non-isPrintable characters removed. |
left | [JVM] open fun left(s: String, length: Int): String Returns a String 'length' long, with 's' left-justified (using spaces as the added characters) within the resulting String. |
lineContaining | [JVM] open fun lineContaining(ar: Array<Any>, s: String): Int This finds the first element in Object[] where the ar[i].toString value contains the substring s. [JVM] open fun lineContaining(ar: Array<Any>, s: String, startAt: Int): Int This finds the first element in Object[] (starting at element startAt) where the ar[i].toString value contains the substring s. |
lineContainingIgnoreCase | [JVM] open fun lineContainingIgnoreCase(ar: Array<Any>, s: String, startAt: Int): Int This finds the first element in Object[] (starting at element startAt) where the ar[i].toString value contains the substring s (ignoring the case of ar and s). |
lineStartsWith | [JVM] open fun lineStartsWith(ar: Array<Any>, s: String): Int This finds the first element in Object[] (starting at element 0) where the ar[i].toString value starts with s. [JVM] open fun lineStartsWith(ar: Array<Any>, s: String, startAt: Int): Int This finds the first element in Object[] (starting at element startAt) where the ar[i].toString value starts with s. |
lineStartsWithIgnoreCase | [JVM] open fun lineStartsWithIgnoreCase(ar: Array<Any>, s: String): Int This variant of lineStartsWith startsAt index=0. [JVM] open fun lineStartsWithIgnoreCase(ar: Array<Any>, s: String, startAt: Int): Int This is like lineStartsWith, but ignores case. |
looselyContains | [JVM] open fun looselyContains(s: String, find: String): Boolean This goes beyond indexOfIgnoreCase by looking after punctuation removed. |
looselyEquals | [JVM] open fun looselyEquals(s1: String, s2: String): Boolean This goes beyond equalsIgnoreCase by looking after punctuation removed. |
makeString | [JVM] open fun makeString(ch: Char, length: Int): String This makes a new String of specified length, filled with ch. |
makeValidUnicode | [JVM] open fun makeValidUnicode(s: String, alsoOK: String): String This makes s valid Unicode by converting invalid characters (e.g., #128) with \uhhhh (literally 2 backslashes, so no info is lost). |
max | [JVM] open fun max(s1: String, s2: String): String This returns the string which sorts higher. |
md5Hex | [JVM] open fun md5Hex(password: String): String This returns the MD5 hash digest of stringToUtf8Bytes(password) as a String of 32 lowercase hex digits. |
md5Hex12 | [JVM] open fun md5Hex12(password: String): String This returns the last 12 hex digits from md5Hex (or null if md5 is null), broken into 3 blocks of 4 digits, separated by '_'. |
min | [JVM] open fun min(s1: String, s2: String): String This returns the string which sorts lower. |
modifyToBeASCII | [JVM] open fun modifyToBeASCII(s: String): String This converts the string to plain ascii (0..127). |
modifyToBeFileNameSafe | [JVM] open fun modifyToBeFileNameSafe(s: String): String This returns the string with just file-name-safe characters (0-9, A-Z, a-z, _, -, .). |
modifyToBeVariableNameSafe | [JVM] open fun modifyToBeVariableNameSafe(s: String): String This is like modifyToBeFileNameSafe, but restricts the name to: - first character must be (iso8859Letter |
noLongerThan | [JVM] open fun noLongerThan(s: String, max: Int): String This returns a string no more than max characters long, throwing away the excess. |
noLongerThanDots | [JVM] open fun noLongerThanDots(s: String, max: Int): String This is like noLongerThan, but if truncated, s.substring(0, max-3) + "..." is returned. |
noLongLines | [JVM] open fun noLongLines(s: String, maxLength: Int, spaces: String): String If lines in s are >=maxLength characters, this inserts "\n"+spaces at the previous non-DigitLetter + DigitLetter; or if none, this inserts "\n"+spaces at maxLength. |
noLongLinesAtSpace | [JVM] open fun noLongLinesAtSpace(s: String, maxLength: Int, spaces: String): String This is like noLongLines, but will only break at spaces. |
parseBoolean | [JVM] open fun parseBoolean(s: String): Boolean This converts a string to a boolean. |
parseBooleanToInt | [JVM] open fun parseBooleanToInt(s: String): Int This converts a string to a boolean and then a Int. |
parseDouble | [JVM] open fun parseDouble(s: String): Double Convert a string to a double. |
parseFloat | [JVM] open fun parseFloat(s: String): Float Parse as a float with either "." or "," as the decimal point. |
parseInt | [JVM] open fun parseInt(s: String): Int Convert a string to an int. [JVM] open fun parseInt(s: String, def: Int): Int Like parseInt(s), but returns def if error). |
parseLong | [JVM] open fun parseLong(s: String): Long This converts String representation of a long. |
passwordDigest | [JVM] open fun passwordDigest(algorithm: String, password: String): String This returns the hash digest of stringToUtf8Bytes(password) as a String of lowercase hex digits. |
periodSpaceConcat | [JVM] open fun periodSpaceConcat(a: String, b: String): String This cleverly concatenates the 2 strings (with "", ". |
quoteParameterIfNeeded | [JVM] open fun quoteParameterIfNeeded(s: String): String For command line parameters, this returns toJson(s) if the string is empty or contains special characters or single or double quotes or backslash; otherwise it return s. |
removeLeading | [JVM] open fun removeLeading(s: String, ch: Char): String This removes leading ch's. |
removeNull | [JVM] open fun removeNull(sar: Array<String>): Array<String> This returns a String[] with just non-null strings from the original array. |
removeNullOrEmpty | [JVM] open fun removeNullOrEmpty(sar: Array<String>): Array<String> This returns a String[] with just non-null and non-"" strings from the original array. |
repeatedlyReplaceAll | [JVM] open fun repeatedlyReplaceAll(s: String, oldS: String, newS: String, ignoreCase: Boolean): String This repeatedly replaces all oldS with newS. |
replaceAll | [JVM] open fun replaceAll(s: String, oldCh: Char, newCh: Char): String Returns a string where all occurences of oldCh have been replaced with newCh. [JVM] open fun replaceAll(s: String, oldS: String, newS: String): String Returns a string where all occurences of oldS have been replaced with newS. |
replaceAllIgnoreCase | [JVM] open fun replaceAllIgnoreCase(s: String, oldS: String, newS: String): String Returns a string where all occurences of oldS have been replaced with newS. |
right | [JVM] open fun right(s: String, length: Int): String Returns a String 'length' long, with 's' right-justified (using spaces as the added characters) within the resulting String. |
roundingParseInt | [JVM] open fun roundingParseInt(s: String): Double Convert a string to an int, with rounding. |
simpleMatlabNameSafe | [JVM] open fun simpleMatlabNameSafe(s: String): String This is like encodeMatlabNameSafe, but simpler and won't always retain all the info. |
split | [JVM] open fun split(s: String, separator: Char): Array<String> This splits the string at the specified character. |
splitNoTrim | [JVM] open fun splitNoTrim(s: String, separator: Char): Array<String> This splits the string at the specified character. |
stringStartsWith | [JVM] open fun stringStartsWith(ar: Array<Any>, s: String): String This returns the first element in Object[] (starting at element 0) where the ar[i].toString value starts with s. |
stringToUtf8Bytes | [JVM] open fun stringToUtf8Bytes(s: String): Array<Byte> This returns the UTF-8 encoding of the string (or null if trouble). |
substitute | [JVM] open fun substitute(msg: String, s0: String, s1: String, s2: String): String This replaces "{0}", "{1}", and "{2}" in msg with s0, s1, s2. |
to0xHexString | [JVM] open fun to0xHexString(i: Int, nHexDigits: Int): String This returns the int formatted as a 0x hex String with at least nHexDigits, e.g., 0x00FF00. |
toByteArray | [JVM] open fun toByteArray(s: String): Array<Byte> This extracts the lower 8 bits of each char to form a byte array. |
toCSSVString | [JVM] open fun toCSSVString(ar: Array<Boolean>): String open fun toCSSVString(ar: Array<Byte>): String open fun toCSSVString(ar: Array<Char>): String open fun toCSSVString(ar: Array<Double>): String open fun toCSSVString(ar: Array<Float>): String open fun toCSSVString(ar: Array<Int>): String open fun toCSSVString(ar: Array<Long>): String open fun toCSSVString(ar: Array<Short>): String This generates a Comma-Space-Separated-Value (CSSV) String from the array. [JVM] open fun toCSSVString(ar: Array<Any>): String Generates a Comma-Space-Separated-Value (CSSV) string. |
toCSVString | [JVM] open fun toCSVString(ar: Array<Any>): String This returns a CSV (not CSSV) String. |
toDoubleArray | [JVM] open fun toDoubleArray(oar: Array<Any>): Array<Double> This converts an Object[] (for example, where objects are Strings or Doubles) into a double[]. |
toFloatArray | [JVM] open fun toFloatArray(oar: Array<Any>): Array<Float> This converts an Object[] (for example, where objects are Strings or Floats) into a float[]. |
toHexCSSVString | [JVM] open fun toHexCSSVString(ar: Array<Byte>): String open fun toHexCSSVString(ar: Array<Int>): String open fun toHexCSSVString(ar: Array<Short>): String This generates a hexadecimal Comma-Space-Separated-Value (CSSV) String from the array. |
toIntArray | [JVM] open fun toIntArray(oar: Array<Any>): Array<Int> This converts an Object[] (for example, where objects are Strings or Integers) into an int[]. |
toIso88591Char | [JVM] open fun toIso88591Char(ch: Char): Char This converts the char to an ISO-8859-1 (ISO_8859_1) char. |
toIso88591Chars | [JVM] open fun toIso88591Chars(car: Array<Char>): Array<Char> This converts the chars to ISO-8859-1 (ISO_8859_1) chars. |
toJson | [JVM] open fun toJson(d: Double): String This makes a JSON version of a number. [JVM] open fun toJson(f: Float): String This makes a JSON version of a float. [JVM] open fun toJson(s: String): String open fun toJson(s: String, firstUEncodedChar: Int): String This makes a JSON version of a string (\, \f, \n, \r, \t and " are escaped with a backslash character and double quotes are added before and after). [JVM] open fun toJson(s: String, firstUEncodedChar: Int, encodeNewline: Boolean): String This is a variant of toJson that lets you encode newlines or not. |
toJson65536 | [JVM] open fun toJson65536(s: String): String This variant doesn't encode high characters. |
toJsonArray | [JVM] open fun toJsonArray(sa: Array<String>): String The converts a string[] into a JSON array of strings. |
tokenize | [JVM] open fun tokenize(s: String): Array<String> This converts a multiple-space-separated string into a String[] of separate tokens. |
toNccsvAttString | [JVM] open fun toNccsvAttString(s: String): String This encodes one String as an NCCSV att String, with surrounding double quotes only if necessary. |
toNccsvChar | [JVM] open fun toNccsvChar(ch: Char): String This encodes one char for an NCCSV char or String, without surrounding quotes. |
toNccsvDataString | [JVM] open fun toNccsvDataString(s: String): String This encodes one String as an NCCSV data String, with surrounding double quotes only if necessary. |
toNewlineString | [JVM] open fun toNewlineString(ar: Array<Double>): String open fun toNewlineString(ar: Array<Int>): String This generates a newline-separated (always '\n') String from the array. [JVM] open fun toNewlineString(ar: Array<Any>): String Generates a newline-separated string, with a newline at the end. |
toRational | [JVM] open fun toRational(d: Double): Array<Int> This converts a double to a rational number (m * 10^t). |
toSentenceCase | [JVM] open fun toSentenceCase(s: String): String This changes the character's case to sentence case (first letter and first letter after each period capitalized). |
toSSVString | [JVM] open fun toSSVString(ar: Array<Any>): String Generates a space-separated-value string. |
toStringArray | [JVM] open fun toStringArray(aa: Array<Any>): Array<String> This converts an Object[] into a String[]. |
toSVString | [JVM] open fun toSVString(ar: Array<Any>, separator: String, finalSeparator: Boolean): String This is used at a low level to generate a 'separator'-separated-value string (without newlines) with the element.toString()'s from the array. |
toTitleCase | [JVM] open fun toTitleCase(s: String): String This changes the characters case to title case (only letters after non-letters are capitalized). |
toVariableName | [JVM] open fun toVariableName(s: String): String This suggests a camel-case variable name. |
trimEnd | [JVM] open fun trimEnd(s: String): String This trims just the end of the string. |
trimStart | [JVM] open fun trimStart(s: String): String This trims just the start of the string. |
utf8BytesToString | [JVM] open fun utf8BytesToString(bar: Array<Byte>): String This returns a string from the UTF-8 encoded byte[] (or ERROR if trouble). |
whichPrefix | [JVM] open fun whichPrefix(prefixes: Array<String>, longerString: String, startAt: Int): Int This finds the first element in prefixes (starting at element startAt) where the longerString starts with prefixes[i]. |
whichSuffix | [JVM] open fun whichSuffix(suffixes: Array<String>, longerString: String, startAt: Int): Int This finds the first element in suffixes (starting at element startAt) where the longerString ends with suffixes[i]. |
whichWord | [JVM] open fun whichWord(longerString: String, words: Array<String>): Int This tries to find the first one of the words in the longerString. |
whitespacesToSpace | [JVM] open fun whitespacesToSpace(s: String): String |
zeroPad | [JVM] open fun zeroPad(number: String, nDigits: Int): String This adds 0's to the left of the string until there are nDigits to the left of the decimal point (or nDigits total if there isn't a decimal point). |