Lets say I have a string with the value "this-is-the-whole-string-value-33297af405e6". I want to extract the last number part from this string. The result I’m looking for is only "33297af405e6". How can I get this value?
Question posted in Javascript
A very good W3school tutorial can be found here.
A very good W3school tutorial can be found here.
2
Answers
For the best performance nothing is faster than searching a string. It could be critical if you process a big JSON data. It’s more than 3x faster that splitting the string:
And benchmarking different solutions:
split()
on-
, and get the last part by callingpop()
on the array: