View Single Post
  #1 (permalink)  
Old October 8th, 2011, 07:23 AM
Antheor Antheor is offline
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Oct 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default string comparison

I've tried to master your though very clear "using strings" chapter, but it's still a bit confused

I only wish to do the following with two strings :
subject = "abcdeabcde"
pattern= "cbaaaf"
and then get
- pattern letters found in subject, getting : 4 cbaa
- subject letters missing in pattern, getting : 6 debcde

My strings are lower letters only, I don't care about letters order in my results.
What I really wish to do is to go through the subjectstring and get the following answer for each letters : isinPattern or isnotinPattern. The problem is that I don't know how to tell, once a letter in pattern has been "used" for comparison", not to look at it again :
When I reach the first c (abCdeabcde) in the subject, I should get OK, but when I reach the second c (abcdeabCde), I should get Not in pattern (since there is only one c in my pattern)...
Hoping I'm clear

On the other hand you provide a cool strtoarray function. Maybe I should convert my string to table then try to compare them...