String Functions
893
Returns the string
str
, right-padded with the string
padstr
to a length of
len
characters. If
str
is
longer than
len
, the return value is shortened to
len
characters.
mysql>
SELECT RPAD('hi',5,'?');
-> 'hi???'
mysql>
SELECT RPAD('hi',1,'?');
-> 'h'
This function is multi-byte safe.
•
RTRIM(str)
[893]
Returns the string
str
with trailing space characters removed.
mysql>
SELECT RTRIM('barbar ');
-> 'barbar'
This function is multi-byte safe.
•
SOUNDEX(str)
[893]
Returns a soundex string from
str
. Two strings that sound almost the same should have identical
soundex strings. A standard soundex string is four characters long, but the
SOUNDEX()
[893]
function returns an arbitrarily long string. You can use
SUBSTRING()
[894]
on the result to get a
standard soundex string. All nonalphabetic characters in
str
are ignored. All international alphabetic
characters outside the A-Z range are treated as vowels.
Important
When using
SOUNDEX()
[893]
, you should be aware of the following
limitations:
• This function, as currently implemented, is intended to work well with strings that are in the English
language only. Strings in other languages may not produce reliable results.
• This function is not guaranteed to provide consistent results with strings that use multi-byte
character sets, including
utf-8
.
We hope to remove these limitations in a future release. See Bug #22638 for more information.
mysql>
SELECT SOUNDEX('Hello');
-> 'H400'
mysql>
SELECT SOUNDEX('Quadratically');
-> 'Q36324'
Note
This function implements the original Soundex algorithm, not the more
popular enhanced version (also described by D. Knuth). The difference is
that original version discards vowels first and duplicates second, whereas the
enhanced version discards duplicates first and vowels second.
•
expr1 SOUNDS LIKE expr2
[893]
This is the same as
SOUNDEX(expr1) = SOUNDEX(expr2)
[893]
.
•
SPACE(N)
[893]
Returns a string consisting of
N
space characters.
mysql>
SELECT SPACE(6);
-> ' '
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...