I need to delete all substrings ending with a
$
symbol within a semi-colon delimited string. Sample string may look
like this (spaces between semi-colon delimiters only for code clarity).
Substrings are of variable lengths:
- dgtrs534u$hi874hbf45 ; kk4746hghf ; 86dgdhdt65jdbsgdb254sf
$277dhcbh74
; re6hdgf554
Final string should look like this:
hi874hbf45
;
kk4746hghf
;
277dhcbh74 ;
re6hdgf554
(these values are always same length each)
I'll use code below. It's the "replace" method I can't
figure out. If I split the string and use something like:
var split = splittedString.slice(-10).join('
;
'); I get "join is not a function". Is there a way to
simply delete substrings left of
all $
(including
$
) down to preceding delimiters without splitting?
- var string = $ ("#string"
).text();
- var finalString = string.replace( substrings
left of all
$ (including $) down to
preceding delimiters ,"");
- $("#string").text(finalString);
Thx for pointers. dan