提取部分字符串 [英] Extract part of the string
本文介绍了提取部分字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要提取部分字符串,例如:
I need to extract part of the string while looks like this for example:
01. Artist Name - Song Title
所以我在开头有一个计数器,点和分隔符可以是任何东西,currenty分隔符是:
So I have counter at the beginning, dot and a separator can be anything, currenty separator is:
var separator =
我想在分隔符后提取所有内容。
I want to extract everything after separator.
使用jquery / javascript。
Using jquery/javascript.
推荐答案
只需在分隔符上拆分字符串并弹出最后一部分:
Just split the string on the separator and pop of the last part :
var lastPart = str.split(separator).pop();
这篇关于提取部分字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文