| Author |
Finding exact element in String
|
pramod talekar
Ranch Hand
Joined: Apr 26, 2010
Posts: 316
|
|
Hello,
I have a string strCurrentTableRow which contains xxxxxxxxxCD01xxCD01(A)xxxxxxxxAB01xxxxxxxxxxxAB01(A)xxxxxxxxx where x is any character and the position of AB01 can change anywhere.
Now, I'm using a variable strCurrentRequiredJf which will have either AB01 or AB01(A), which will be dynamic, meaning it can be CD01 or CD01(A) as well based on the stuff selected by the end user.
I have an IF condition in a part of the code which contains many WHILE loops,
in this case, since 'contains' returns true both for AB01 & AB01(A), the code in the loop will execute twice whereas it should have happened just once.
In short, how to find the exact substring in a string.
contains() doesn't work, so does indexOf().
So how to rectify this issue.
Please advise.
|
Thanks,
Pramod
|
 |
pramod talekar
Ranch Hand
Joined: Apr 26, 2010
Posts: 316
|
|
I changed in the indexOf condition and found the result.
|
 |
 |
|
|
subject: Finding exact element in String
|
|
|