String._extension._modify
- Source
- _modify.scala
Def
Insert at position
Insert at position
Creates new String with x
inserted at the specified position
"0123456789".insertAt(5,"abc") tp // Prints: 01234abc56789
- Source
- _modify.scala
Capitalize
Capitalize
Capitalizes first character of every word (separated by white spaces)
"all string ops".tag tp // Prints: All String Ops
- Source
- _modify.scala
toLowerCase
toLowerCase
Creates new String with all upper case Chars changed to lower case
"ABc".lower tp // Prints: abc
- Source
- _modify.scala
Pad end
Pad end
Pads end of string to targetLength
- Value Params
- pad
string to pad with.
"ABC".padEndTo(10,"_") tp // Prints: ABC_______
- Source
- _modify.scala
Pad start
Pad start
Pads start of string to targetLength
- Value Params
- pad
string to pad with.
"ABC".padStartTo(10,"_") tp // Prints: _______ABC
- Source
- _modify.scala
Remove all
Remove all
Creates new String with all occurrences of x
removed
"123123123123".remove("2") tp // Prints: 13131313
- Source
- _modify.scala
Replace range with x
Replace range with x
Creates new String with all occurrences of x
replaced with target
"0123456789".replace(3 <> 7 ,"_") tp // Prints: 012_89
- Source
- _modify.scala
Replace all
Replace all
Creates new String with all occurrences of x
replaced with target
"123123123123".replace("2","_") tp // Prints: 1_31_31_31_3
- Source
- _modify.scala
Trim both ends
Trim both ends
Trims both ends of String from Chars defined by let function
"yyxxxxABCxxyyxx".trimBoth('x' <> 'z') tp // Prints: ABC
"yyxxxxABCxxyyxx".trimBoth(c => c == 'x' || c == 'y') tp // Prints: xxxxABCxx
- Source
- _modify.scala
Trim both ends
Trim both ends
Trims end of String from Chars defined by let function
"ABCxxyyxx".trimEnd('x' <> 'z') tp // Prints: ABC
"ABCxxyyxx".trimEnd(c => c == 'x' || c == 'y') tp // Prints: ABCxx
- Source
- _modify.scala
Trim start
Trim start
Trims start of String from Chars defined by let function
"yyxxxxABC".trimBoth('x' <> 'z') tp // Prints: ABC
"yyxxxxABC".trimBoth(c => c == 'x' || c == 'y') tp // Prints: xxxxABC
- Source
- _modify.scala
toUpperCase
toUpperCase
Creates new String with all lower case Chars changed to upper case
"aBc".upper tp // Prints: ABC
- Source
- _modify.scala