String Functions
String manipulation and transformation methods available in kScript v2.0 for text processing.
Usage
All string methods are called directly on string values using JavaScript-style method syntax. They behave exactly like standard JavaScript string methods.
Available Methods
split()
Splits a string into an array of substrings using a separator
str.split(separator)concat()
Concatenates multiple strings together into a single string
str.concat(...strings)substring()
Extracts a portion of the string between two indices
str.substring(start, end?)toUpperCase()
Converts all characters in the string to uppercase
str.toUpperCase()toLowerCase()
Converts all characters in the string to lowercase
str.toLowerCase()trim()
Removes whitespace from both ends of the string
str.trim()replace()
Replaces the first occurrence of a search string with a replacement string
str.replace(search, replaceWith)indexOf()
Returns the index of the first occurrence of a substring (-1 if not found)
str.indexOf(searchValue)startsWith()
Checks if the string starts with the specified prefix
str.startsWith(prefix)endsWith()
Checks if the string ends with the specified suffix
str.endsWith(suffix)length()
Returns the number of characters in the string
str.length()