subset function for string

P

puzzlecracker

basically, I need to find out wether charecters in string a are subset
of string b..


example

a: rx b:rwx
that shall return true.
 
V

Victor Bazarov

puzzlecracker said:
basically, I need to find out wether charecters in string a are subset
of string b..


example

a: rx b:rwx
that shall return true.

Take each character in 'a' and try finding it in 'b' (using 'find'
function), and if it fails, return false, otherwise return true after
doing the last character.

V
 
P

puzzlecracker

Victor said:
Take each character in 'a' and try finding it in 'b' (using 'find'
function), and if it fails, return false, otherwise return true after
doing the last character.

V
Thanks, but I have done something cuter:

string a,b;
.... // init both

a.find_first_not_of(b);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,779
Messages
2,569,606
Members
45,239
Latest member
Alex Young

Latest Threads

Top