You can translate the question and the replies:

How to split a string at a delimiter

I have a string "India (IN)" I only want the country name India removing the delimiters and abbreviation (IN) Split function is not working.
user
13-05-2022 19:25:31 -0400
code

1 Answer

Hello, That can be achieved using two functions available in Denodo - **[SPLIT](https://community.denodo.com/docs/html/browse/latest/en/vdp/vql/functions/text_functions/text_functions#split)** and **[REGEXP](https://community.denodo.com/docs/html/browse/latest/en/vdp/vql/functions/text_functions/text_functions#regexp)**. Using **SPLIT()** you will get the country and the country code divided into rows inside an array, therefore you will have then to select the array element that matters to you, following the example below would be field[0], which is a register. After that, you would need to project the subfield of the register so that you get a text field. ``` SELECT (field).string from ( SELECT field[0] from ( SELECT SPLIT(' ', 'India (IN)') as field)) ``` The same can be achieved using the **REGEXP** function. This function is used to replace a value with another based on a regular expression, so the idea here would be to replace ‘(IN)’ with ‘ ‘ and you would also achieve the same result. Hope this helps!
Denodo Team
17-05-2022 04:45:54 -0400
code
You must sign in to add an answer. If you do not have an account, you can register here