I have two strings. The strings are for example like this :
string1 = "swim foward"
string2 = "smim foward"
So when i compare them, they are not equal.
Can i compare them somehow, so that i know they look alike?
I have two strings. The strings are for example like this :
string1 = "swim foward"
string2 = "smim foward"
So when i compare them, they are not equal.
Can i compare them somehow, so that i know they look alike?
lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu
What do you mean "look alike"? You mean if they're close enough like the example you gave (perhaps to check for typos)?
Sent from my iPadŽ
you could count charactors that are the same and use that as an indication of how alike the strings are.
exactly.Originally Posted by SlyMaelstrom
lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu
Yes.
String length / number of matched characters * 100 = percentage of similarity between strings
Just be careful if you were planning to autocorrect strings, as there are similar correct words.
Think:
"Meet me in the car"
"Meet me in the bar"
Sent from my iPadŽ
How well does that work for pure typing errors?
I can see that working good for phonetics such as someone spelling "knife" as "nife" or "phone" as "fone", but lets say someone wrote "phgonbe" instead of "phone".
Sent from my iPadŽ
allright i got it, thanks for the help.
lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu