[SOLVED]Mixed String Matching Problem

Hello, i am trying to get a word with the characters mixed up to match its original word. For example i need eveldpometn to match development, they both are strings inside of different tables and both have the same letters and case, I can reverse a string and match them if they are the same word with no problems but i cant seem to wrap my head around the string function to accomplish this when the word’s characters are mixed up. Any help with this would be greatly appreciated! Thanks in advance! [import]uid: 126161 topic_id: 23872 reply_id: 323872[/import]

Hey, I found a solution. The trick is to convert the string to numbers, char by char, and then simply compare those numbers:

  
 local s1 = "edvelpometn"  
 local s2 = "development"  
  
 local total1 = 0  
 local total2 = 0  
  
 for i=1, string.len(s1) do  
 total1 = total1 + s1:byte(i)  
 end  
  
 for i=1, string.len(s1) do  
 total2 = total2 + s2:byte(i)  
 end  
  
 print ('---total1', total1)  
 print ('---total2', total2)  
  
 if total1 == total2 then  
 print ('match!')  
 else  
 print ('no match :(')  
 end  
  

Hope that helps!

Raúl Beltrán
MIU Games
http://miugames.com [import]uid: 44101 topic_id: 23872 reply_id: 96236[/import]

That words perfectly! Thanks for your help! I never thought of adding the bytes. [import]uid: 126161 topic_id: 23872 reply_id: 96263[/import]