forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com> Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
6.5 KiB
6.5 KiB
translate
This function is used to translate the input string by replacing the characters or string specified by from with the characters or string specified by to.
For example, it replaces bcd in abcde with BCD.
translate("abcde", "bcd", "BCD")
Syntax
translate(string|char|varchar input, string|char|varchar from, string|char|varchar to)
Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
str |
Yes |
STRING |
String to be truncated |
separator |
Yes |
STRING |
Separator of the STRING type |
count |
No |
INT |
Position of the delimiter |
Return Values
The return value is of the STRING type.
Example Code
The value A1B2C3 is returned.
SELECT translate('AaBbCc', 'abc', '123');
Parent topic: String Functions