(8) to delete the function of the specified stringTRIM (S1 from S)
TRIM (S1 from S2) deletes all substrings in the string s s1. S1 is optional, and when unspecified, removes spaces.
Select Trim (' xy ' from ' xyxboxyokxxyxy ');
(9) function for repeating string generationREPEAT (s,n)
Returns a string consisting of a repeating string s , and the number of s is n. If n<0, returns an empty string. returns null if s or n is null
Select repeat (' MySQL ', 3);
(Ten) space functionSPACE (n)and replace functionsREPLACE (S,S1,S2)
Space (n) returns a string consisting of n spaces.
Select Concat (' (', Space (6), ') ');
Select replace (' xxx.mysql.com ', ' x ', ' W ');
( Onea function that compares the size of a stringSTRCMP (S1,S2)
Returns 0if two strings are equal,or 1if s1<s2returns 1
Select strcmp (' AA ', ' AA '), strcmp (' abc ', ' ACB '), strcmp (' ACB ', ' abc ');
(12) Get the SUBSTRING function substring (s,n,len)and theMID (S,n.len)
SUBSTRING (S,n,len) returns a substring of length len that was searched from n position . MID (s,n.len) acts the same as the former.
Select substring (' ABCDEFG ', 4, 3);
Select mid (' ABCDEFG ', 2,2);
(13) function to match the starting position of a substring
LOCATE (STR1,STR),POSITION (str1 in str2) and INSTR (STR,STR1) 3 functions are the same. Returns the starting position of the substring str1 in the string str
Select locate (' Ball ', ' football '), position (' ball ' in ' Football '), InStr (' Football ', ' Ball ');
(14) Inverse string function reverse (s)
Select reverse (' 12345 ');
(15) Returns a string function at the specified position
ELN (N, string 1, string 2, string 3 ... string N) if n=1 , the return value is a string 1 , if n=2 , returns a string 2 ...
Select ELT (3, ' 123 ', ' abc ', ' 456 ', ' def ');
(16) Returns the location of the specified string in the return field (S,S1,S2...)
Select field (' 123 ', ' abc ', ' 123 ');
(17) function Find_in_set (S1,S2) to return substring position
Returns the position where the string S1 appears in the string s2 .
Select Find_in_set (' 123 ', ' abcd,1234,efg,123 ');
MySQL Self-study chapter (ix)--string function (ii)