Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with string manipulation 1

Status
Not open for further replies.

adi316

Programmer
Sep 10, 2002
35
0
0
CA
why is it that when i do this:

output = line.substr(line.find("V"),line.find("/")) + " ";
line.erase(0,line.find("//")+3);
output+=line;

on this line for example:

line = 27009V234288/27008G00000000/270008// 14 2707 08 234288 032022

i get this:

output == V234288/2700 14 2707 08 234288 032022

instead of this:

V234288 14 2707 08 234288 032022
 
because of:

>> output = line.substr(line.find("V"),line.find("/")) + " ";

after this output is already equal to:

V234288/2700

since line.find("/") returns 12 so you get a 12 character string starting at "V" or 5

-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top