Identify series of a string

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: May 2005
Posts: 4
Reputation: swets_here is an unknown quantity at this point 
Solved Threads: 0
swets_here swets_here is offline Offline
Newbie Poster

Identify series of a string

 
0
  #1
May 31st, 2005
If your input is "abc". What would be the logic to accept the strings, bca,acb,bac,cab,cba,abc (ie. the same string with chars placed in any order)
and reject all other input strings like aab, cdb, xyz etc ?
Note: The reference string("abc") is not fixed, logic should work for any constant string irrespective of its size.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 466
Reputation: winbatch is on a distinguished road 
Solved Threads: 18
winbatch's Avatar
winbatch winbatch is offline Offline
Posting Pro in Training

Re: Identify series of a string

 
0
  #2
May 31st, 2005
the string class has a function, find_first_not_of( ), where you can just give it your original string "abc". It searches to find any characters that aren't in the list of the ones you provided. (you would want it to return -1 which means it didn't find any)
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 4
Reputation: swets_here is an unknown quantity at this point 
Solved Threads: 0
swets_here swets_here is offline Offline
Newbie Poster

Re: Identify series of a string

 
0
  #3
Jun 3rd, 2005
Thanks! I tried using it but the compiler fails to recognize this function. Is it present in the stdlib?

Is the usage like,
check_flag = find_first_not_of(abc) ;
//where to I give the string to be compared?

Can you pls gimme the exact protype for this function find_first_not_of( )?
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 466
Reputation: winbatch is on a distinguished road 
Solved Threads: 18
winbatch's Avatar
winbatch winbatch is offline Offline
Posting Pro in Training

Re: Identify series of a string

 
0
  #4
Jun 3rd, 2005
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC