AppLib CHAR REPLACE
From LucidDB Wiki
Contents |
Syntax
APPLIB.CHAR_REPLACE ( string, existing_character, new_character ) APPLIB.CHAR_REPLACE ( string, existing_int, new_int )
Purpose
Replaces a character in a string with another character by specifying the character directly or via ascii code. If any of the inputs are null, result will be null.
Parameters
- string [VARCHAR(65563)]: The string to be used.
- existing_character [VARCHAR(1)]: The character to be replaced. Length must be 1.
- new_character [VARCHAR(1)]: The character to replace the existing_character. Length must be 1.
- existing_int [INTEGER]: The ascii code of the character to be replaced.
- new_int [INTEGER]: The ascii code of the character existing character is being replaced with.
Output
- [VARCHAR(128)] string with replaced character(s)
Example
| Name | CHAR_REPLACE( NAME, 'e', 'A') | CHAR_REPLACE(NAME, 'a', 'la') | CHAR_REPLACE(NAME, 99, 33) |
|---|---|---|---|
| 3993abc | 3993abc | 3993labc | 3993ab! |
| Bernard Walsh | BArnard Walsh | Bernlard Wlalsh | Bernard Walsh |
| Joan Yu | Joan Yu | Jolan Yu | Joan Yu |
| Martin Blair | Martin Blair | Mlartin Bllair | Martin Blair |
| Mike Rodriguez | MikA RodriguAz | Mike Rodriguez | Mike Rodriguez |
| Olivia Kuznetsov | Olivia KuznAtsov | Olivila Kusnetsov | Olivia Kuznetsov |
| walter king | waltAr King | wlalter King | walter king |