HandyString extension
Methods
-
appearances(String other)
→ int
-
Counts the number of times
other
appears in the string.
Example: "aaabc".count('a') == 3
-
capitalize()
→ String
-
Capitalizes the first letter of a string and turns all other letters lowercase.
Example: "abc".capitalize() == "Abc"
-
center(int width, {String filler = " "})
→ String
-
Centers the string using
filler
as padding.
Example: "abc".center(7, "-") == "--abc--"
-
toTitleCase()
→ String
-
Capitalizes each word in the string.
Example: "rayman 2: the great escape".toTitleCase() == "Rayman 2: The Great Escape"
Operators
-
operator *(int repeats)
→ String
-
Multiplies a string like python does.
Example: "abc" * 3 == "abcabcabc"