Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
I am having issues getting IndexOf() to return a value unless I have a single string, or concat two (non Variable) strings.
IDE: Visual Studio 2010 C++
Type: Forms Application 32bit
Compiled on: Windows 7 Home Premium 64bit
int Index = 0;
temp = Name + "","" + Zone; // result: NAME","ZONE
Index = str->IndexOf(temp); // result: -1 This fails
int Index = 0;
temp = "NAME" + "","" + "ZONE"; // result: NAME","ZONE
Index = str->IndexOf(temp); // result: (The correct Index #) This Works
Index = str->IndexOf(Zone); // result: This also works so the information in the variables is good. Right?
Why does the first example not work?
I have tried using String::Concat() and it does the same thing.
I have tried for hours checking and rechecking. I can't find any good information on why this is happening.
Again: Why can't I get the Index of a string that has been concatnated with one or more strings?
The problem i'm having is i swear i have done this many times before. and today i can't get this one simple thing to work :(
0 · ·