This is a question from StackOverflow (link
http://stackoverflow.com/questions/35122231/ Mysql-how-to-get-numeric-value-after-special-character-in-varchar)
I have a bunch of records, how do I get the right-most value after the slash "/" in this series of records (1,2,10), which is great if you have PHP code that can automatically reset the month value.
Reply:
Suppose you know that all records are in the form of a/x/y, and then "/" is always used as a special symbol, then you can use explode ()
Code:
substring_index(): select substring_index(col,'/',-1)
from t;
If you want to turn what you get t
into numbers,
select substring_index(col,'/',-1)+1
from t;
A second answer:
Try this:
$str = "ABC/209116/1";
$replace_with = "0";
$str= substr(0,strrchr($str,"/"));
$replace_with;
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes how MySQL obtains the value after a special character in a variable length string (from StackOverflow), including the contents of the content, I hope that the PHP tutorial interested in a friend helpful.