Sign in to follow this  
Followers 0
DigitalIsBetter

How do I remove LineFeed

4 posts in this topic

How do I remove the last linefeed in a file.

This is how it looks

1 = Blah

2 = Blah

3 = Blah

4 =

each line has a LF at the end

1 = Blah\n

2 = Blah\n

3 = Blah\n

4 =

I want it to look like this

1 = Blah\n

2 = Blah\n

3 = Blah

Thanks for the help.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

is this an inifile.?

no the numbers in the example are line numbers.

the file when opened would actually look like this

Blah

Blah

Blah

Edited by Learning

Share this post


Link to post
Share on other sites

you need to count the lines , then check if its last line , then replace the value

something like this?

$tal_text = StringReplace($tal_text, "\n", "");

$tal_text = StringReplace($tal_text, @CRLF, "");

$tal_text = StringReplace($tal_text, @LF, "");

$tal_text = StringReplace($tal_text, @CR, "");

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0