0

How to do I go about changing a string from "\n \t\t\t\t\t\t\tArthur Lynch \t\t\t\t\t\t" to "Authur Lynch" in javascript.

Joel Henry
  • 31
  • 3
  • 2
    Does this answer your question? [Remove tab ('\t') from string javascript](https://stackoverflow.com/questions/9018015/remove-tab-t-from-string-javascript) – azbarcea Jan 25 '22 at 02:51
  • 2
    If it's just whitespace at the beginning and end, use `string.trim()` – Barmar Jan 25 '22 at 02:52

1 Answers1

0

try str.replace(regexp|substr, newSubstr|function)

e.g.

str.replace(/\n/g,'').replace(/\r/g,'');
Ian
  • 1,198
  • 1
  • 5
  • 15