String function

Hello All,


I have few doubt about find_first_of() function.
Can I use find_first_of() function with char* ?

1. int main()
2. {
3. char *mystring = "%Myvariable=option1||option2||option3%";
4. char *equalsign = find_first_of(mystring, "=");
5. }

In line number:4 I am using find_first_of() function on a char* , Can I do this and what will be the return type for this function in both the case if we found "=" or if not?

Thanks u all in advance. . .
There is a fine standard library reference on this site.
Find 'Reference' on the side menu then string->string->find_first_of
Thanks hamsterman,

I went through the reference document page but there example is explained with the string variable.
It will be great if you can explain it with an example of char* :)
There is also an STL agorithm named find_first_of. That's what you want:
http://cplusplus.com/reference/algorithm/find_first_of/
If you want to do this with two char* try strstr(). http://www.cplusplus.com/reference/clibrary/cstring/strstr/
Last edited on
Thanks hamsterman . . :)
Topic archived. No new replies allowed.