I have two strings :
String s1 = "D3516025204 StackOverflow is good.";
String s2 = "D3516025204 StackOverflow Nice to see you.";
First compare both the string character by character and print the indexes or column no. if the characters are different. I need to include the spaces in the string.
Like in above string :
Difference of indexes from s1 and s2: 34 to 48.
I tried below :
char[] first = text1.toLowerCase().toCharArray();
char[] second = text2.toLowerCase().toCharArray();
int minimum = Math.min(first.length, second.length);
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < minimum; i++) {
if (first[i] != second[i]) {
do{
//System.out.print(first[i]+" "+second[i]);
System.out.println(text1.offsetByCodePoints(first[i],text1.indexOf(second[i])));
}while(first[i] == second[i]);
}
}