J
Jorge Rojas
I have a question. I'm dealing with indexof and I got a behaviour I never
expected...
From documentation,
public int IndexOf (
string value,
int startIndex,
int count
)
should return the "count" occurrence of search after start.
Am I wrong?
The code (c#):
/******/
string aSearch;
int aPos;
aSearch = "This is a dumb test, a simple test for testing a test
I want to test";
aPos = aSearch.IndexOf("test", 2, 1);
/******/
I got aPos= -1 ??? How???
Another:
/******/
aSearch = "This is a dumb test, a simple test for testing a test
I want to test";
aPos = aSearch.IndexOf("test", 1, 1);
/******/
I got aPos = -1 again...
The only one that works is aString.IndexOf(search, index) Any ideas? What I
am doing wrong?
expected...
From documentation,
public int IndexOf (
string value,
int startIndex,
int count
)
should return the "count" occurrence of search after start.
Am I wrong?
The code (c#):
/******/
string aSearch;
int aPos;
aSearch = "This is a dumb test, a simple test for testing a test
I want to test";
aPos = aSearch.IndexOf("test", 2, 1);
/******/
I got aPos= -1 ??? How???
Another:
/******/
aSearch = "This is a dumb test, a simple test for testing a test
I want to test";
aPos = aSearch.IndexOf("test", 1, 1);
/******/
I got aPos = -1 again...
The only one that works is aString.IndexOf(search, index) Any ideas? What I
am doing wrong?