Hi All, Is there a routine to find a substring in a String? I would like to have a routine that can be used in this way: String* S; String* SubStr = "."; do { S = Console::ReadLine() } while(Pos(SubStr, S) == 0); //Pos returns the index of the first letter of the substring inside the string. And if it doesn't find the substring, then it returns 0.
I was looking for a routine that works with .net and not the old C++. I found what I was looking for though: String* S; String* SubStr = "."; do { S = Console::ReadLine() } while(S->IndexOf(SubStr) < 0);
Do you really sure what this line of code does? Code: String* SubStr = "."; It seems you are assigning the random address to your pointer-to-string variable...