Jump to content

Recommended Posts

Posted

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.

Posted

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, "");

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
×
×
  • Create New...