connexo
connexo

Reputation: 56754

How to remove a preceding line-break from a Javascript string

This is the string I have:

"
Store: Tailor Shop (1)
Send complete welcome package
Datasheet was completed at 01.01.2000"

How can I convert it to

"Store: Tailor Shop (1)
Send complete welcome package
Datasheet was completed at 01.01.2000"

?

Upvotes: 0

Views: 81

Answers (1)

Avinash Raj
Avinash Raj

Reputation: 174706

You may try this,

string.replace(/\n/, '')

Regex without g modifier would remove only the first newline character.

Upvotes: 1

Related Questions