I laugh in the face of complicated string problems. With this library, you can too.
- You can install this string library here via npm
- Below you will find the functions included in this library and how to use them.
- Capitalizes the first letter of a string.
"capitalize me".capitalize() -> "Capitalize me"
- Capitalizes all characters in a string.
"upper me".upper() -> "UPPER ME"
- Capitalizes all words in a string.
"capitalize my words".capitalizeWords() -> "Capitalize My Words"
- Capitalizes all words in a string except: "the", "in", "a", "an", "and", "but", "for", "at", "by", "from"
- Always capitalizes the first word of the string.
"a headline from a publication".capitalizeHeadline() -> "A Headline from a Publication"
- Removes all types of white space. If two words have more than one white space character between them, a single space is left there.
"\n\n\n\n Destroy \t\t\t\r\rAll Whitespace \n \t \r ".removeExtraSpaces() -> "Destroy All Whitespace"
- Lowercases string, removes extra spaces, and replaces spaces with "-"
"mAkE \n mE A KeBaB ".kebabCase() -> "make-me-a-kebab"
- Lowercases string, removes extra spaces, and replaces spaces with "_"
"mAkE \n mE A sNaKE ".snakeCase() -> "make_me_a_snake"
- Removes all spaces, capitalizes each word except the first.
"MAKE thiS Camel case".camelCase() -> "makeThisCamelCase"
- Shifts the first letter of the string to the end of the word.
"Hello World".shift() -> "elloWorldH"
- Returns an array of the 3 longest words preceded by a hashtag.
"there was a potato and a beachball and a forest ".makeHashTag() -> ["#potato", "#beachball", "#forest"]
- Returns true if the given string contains only whitespace.
"\n\n\n \t\t \r\r".isEmpty() -> true
"Some characters".isEmpty() -> false