Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem with indexOf() method

807607Oct 7 2006 — edited Oct 7 2006
I'm facing a problem while trying to format a string according to my criteria. I need to make a substring of the string giving the position using indexOf method. But the method isn't working well as I need. Given below is the code.......

temp1 = 3O|1||V06080000210R^A^04|^^^106^HBsAg^UNDILUTED|R||||||||||||||||||||F<CR><ETX>61<CR><LF>

I need to cut the string from ^'s 6th position+1 until 7th position-1.

I'm using indexOf method to draw the solution as given below....

int tst = temp1.indexOf('^',5);
int tst1 = temp1.indexOf('^',6);

Problem is it's not working. Can someone help me draw the solution?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 4 2006
Added on Oct 7 2006
1 comment
106 views