Kotlin String Operations
In this tutorial, we shall learn different string operations that are available in Kotlin programming language.
String Tutorials
Basics
- Kotlin – Initialize string
- Kotlin – Create empty string
- Kotlin – Define a string constant
- Kotlin – Get string length
- Kotlin – Print a string
- Kotlin – Concatenate strings
- Kotlin – Compare strings
- Kotlin – Multiline strings
Checks
- Kotlin – Check if strings are equal
- Kotlin – Check if strings are equal ignoring case
- Kotlin – Check if string is empty
- Kotlin – Check if string contains specific substring
- Kotlin – Check if string contains specific character
- Kotlin – Check if string starts with specific prefix
- Kotlin – Check if string starts with specific character
- Kotlin – Check if string ends with specific suffix
- Kotlin – Check if string ends with specific character
- Kotlin – Check is string matches regular expression
Finds
- Kotlin – Count number of words in string
- Kotlin – Find index of substring
- Kotlin – Get random character from string
- Kotlin – Substring
Transformations
- Kotlin – Capitalize a string
- Kotlin – Convert string to lowercase
- Kotlin – Convert string to uppercase
- Kotlin – Filter characters of string
- Kotlin – Join strings by a separator
- Kotlin – Remove first N characters from string
- Kotlin – Remove last N haracters from string
- Kotlin – Repeat string N times
- Kotlin – Reverse a string
- Kotlin – Sort characters in string
- Kotlin – String replace
- Kotlin – Trim white spaces around string
Split Operations
- Kotlin – Split string
- Kotlin – Split string to lines
- Kotlin – Split string by comma
- Kotlin – Split string by single space
- Kotlin – Split string by any whitespace character
- Kotlin – Split string by one or more spaces
Conversions
- Kotlin – Convert char array to string
- Kotlin – Convert string to char array
- Kotlin – Convert byte array to string
- Kotlin – Convert string to byte array
- Kotlin – Convert string to list of characters
- Kotlin – Convert list of characters to string
- Kotlin – Convert string to set of characters
Character specific Operations
- Kotlin – Get character at specific index in string
- Kotlin – Get first character in string
- Kotlin – Get last character in string
- Kotlin – Iterate over each character in string
- Kotlin – Insert character at specific index in string
- Kotlin – Get unique characters in string
- Kotlin – Remove character at specific index in string
- Kotlin – Remove first character in string
- Kotlin – Remove last character in string
- Kotlin – Replace specific character with another in a string
- Kotlin – Remove specific character in a string
String Formatting
String Collections
- Kotlin – List of strings
- Kotlin String List – Filter based on Length
- Kotlin – Filter only strings in this list
- Kotlin List – Filter non-empty strings
- Kotlin – Create a set of strings
- Kotlin – Create string array
- Kotlin – Sort array of strings
- Kotlin – Sort string array based on string length
Conclusion
In this Kotlin Tutorial, we learned some of the String operations that are most frequently used in Kotlin application development.