nnnn
nnnn

Reputation: 1051

JAVASCRIPT:Is there a faster way to get this string split by a multi-character delimiter?

I know this is a newbie question,but I am finding a simple solution .
For example, Resource=>"cancel_&MyButton";
I want to get a result string "cancel" that is a first part of Resource splitted by a multi-character delimiter "_&" .
Result=>"cancel"
Can you give me a fastest and simplest way?
Thanks.

Upvotes: 0

Views: 137

Answers (1)

xdazz
xdazz

Reputation: 160933

"cancel_&MyButton".split('_&')[0] will give the result.

Upvotes: 5

Related Questions