cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to remove / in the data extraction

Banu
New Contributor

Hi Team,

can anyone help me how to remove / from the data.
for some i am getting / for some i am getting data as expected

3 REPLIES 3

viktor_n
Contributor II

Hi @Banu

If itโ€™s string than you can use $data.replaceAll('/', '')
But if itโ€™s different type you can also try $data.toString() and after that add .replaceAll('/', '').

Banu
New Contributor

Thanks Viktor that helped

can you also help me to remove the data which contains / in the array.
i want to eliminite that completley

viktor_n
Contributor II

Hi @Banu

This time you need to iterate through the array.
That can be done by using .map() function. See the documentation for more information about this function.

There is it:
https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1438091/Array+Functions+and+Properties#Arr...

if itโ€™s array of strings you can write $array.map(x => x.replaceAll('/', '')).

Maybe you have array of objects and in that object you have field from which you want to remove the โ€˜/โ€™, than you just need to map the field in that object.

Like that $array.map(x => x.field.replaceAll('/', ''))