delete chars until end of line

R

RicK

Hy guys,

I'm sorry for my bad english,

I have a problem writing a text file:

I have this 2 lines:
abcd = 0;zzzzzzzzzzzzzzzzzzzz
fghi = 1;
and I want delete all next ';' (zzzzzzzzzzzzzzz) but not erase the second
line;

regards
RicK
 
J

Jim Langston

RicK said:
Hy guys,

I'm sorry for my bad english,

I have a problem writing a text file:

I have this 2 lines:
abcd = 0;zzzzzzzzzzzzzzzzzzzz
fghi = 1;
and I want delete all next ';' (zzzzzzzzzzzzzzz) but not erase the second
line;

You say you have problem writing a text file. Which mean that you have it
in memory somehow to be able to write it (even if you read it from another
file).

Without knowing the specifics, it sounds as simple as getting rid of
everything past the ;. It may be as simple as:

Line = Line.substr(0, Line.find_first_of(';') );

Hard to know without seeing your code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top