HandyString extension

on

Methods

appearances(String other) int

Available on String, provided by the HandyString extension

Counts the number of times other appears in the string. Example: "aaabc".count('a') == 3
capitalize() String

Available on String, provided by the HandyString extension

Capitalizes the first letter of a string and turns all other letters lowercase. Example: "abc".capitalize() == "Abc"
center(int width, {String filler = " "}) String

Available on String, provided by the HandyString extension

Centers the string using filler as padding. Example: "abc".center(7, "-") == "--abc--"
toTitleCase() String

Available on String, provided by the HandyString extension

Capitalizes each word in the string. Example: "rayman 2: the great escape".toTitleCase() == "Rayman 2: The Great Escape"

Operators

operator *(int repeats) String

Available on String, provided by the HandyString extension

Multiplies a string like python does. Example: "abc" * 3 == "abcabcabc"