Javascript: How to remove characters from end of string?
JavascriptStringJavascript Problem Overview
I have a string "foo_bar"
and "foo_foo_bar"
. How do I remove the last "_bar"
from the string? So I'm left with "foo" and "foo_foo"
.
I have a string "foo_bar"
and "foo_foo_bar"
. How do I remove the last "_bar"
from the string? So I'm left with "foo" and "foo_foo"
.
All content for this solution is sourced from the original question on Stackoverflow.
The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.
Content Type | Original Author | Original Content on Stackoverflow |
---|---|---|
Question | Albert | View Question on Stackoverflow |