To find the difference between 2 Strings you can use the StringUtils class and the difference method. It compares the two Strings, and returns the portion where they differ.
What is the cleanest way of finding the position of the first difference in any two strings in Javascript?
var a = 'in the';
var b = 'in he';
findFirstDiffPos(a, b); // 3
var c = 'in the beginning';
findFirstDiffPos(a, c); // 6
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With