拆分字符串并取最后一个元素 [英] Split string and take last element
本文介绍了拆分字符串并取最后一个元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个包含此值的表:
I have a table with this values:
Articles/Search/ArtMID/2681/ArticleID/2218/Diet.aspx
OurStory/MeettheFoodieandtheMD.aspx
TheFood/OurMenu.aspx
我想要这个
Diet.aspx
MeettheFoodieandtheMD.aspx
OurMenu.aspx
我该怎么做?
推荐答案
SQL 中的做法:
SELECT SUBSTRING( string , LEN(string) - CHARINDEX('/',REVERSE(string)) + 2 , LEN(string) ) FROM SAMPLE;
JSFiddle在这里http://sqlfiddle.com/#!3/41ead/11
JSFiddle here http://sqlfiddle.com/#!3/41ead/11
这篇关于拆分字符串并取最后一个元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文