Swap
Swap

Reputation: 11

how to get output by splitting a string in angular js

I have a string -

"126_VAMSI, SWAP L. NA_8092069876"

i need to get "VAMSI, SWAP L. NA" as an output i.e. the words between the underscore, then what should be my approach.

Upvotes: 0

Views: 44

Answers (1)

ajaykumar
ajaykumar

Reputation: 656

If your question is complete and string only has two underscores and you want the middle text between underscores. Then this is your answer.

str.split("_")[1];

If your questioned string is variant pls elaborate

Upvotes: 2

Related Questions