@tempots/std
stringsDifferAtIndex() function
Compares strings a
and b
and returns the position where they differ. If the strings are equal, it returns -1
.
Signature:
stringsDifferAtIndex: (a: string, b: string) => number
Parameters
Parameter |
Type |
Description |
---|---|---|
a |
string |
The first string to compare. |
b |
string |
The second string to compare. |
Returns: number
The position where the strings differ, or -1
if they are equal.
Example
stringsDifferAtIndex('abcdef', 'abc123') // returns 3