Strings

autoCorrect (word: string, dict: Array<string>): undefined|string

Tries to auto-correct a word from a dictionary.

Name Type Default Description
word string    
dict Array<string>    

isPalindrome (str: string): boolean

Checks if a string is a palindrome.

Name Type Default Description
str string    

stringDistance (s1: string, s2: string, ignoreTrailing: boolean): number

Determines the Levenshtein distance between two strings. If ignoreTrailing is true, we will ignore any additional, trailing characters in s2.

Name Type Default Description
s1 string    
s2 string    
ignoreTrailing boolean false  

toCamelCase (str: string): string

Converts a string to camel case.

Name Type Default Description
str string    

toTitleCase (str: string): string

Converts a string to title case.

Name Type Default Description
str string    

words (str: string, divider: RegExp): Array<string>

Splits a string into space separated words.

Name Type Default Description
str string    
divider RegExp  

Copyright © 2024 Mathigon.org