04-15-2021 01:57 AM
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
04-15-2021 02:10 AM
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('/', '')
.
04-15-2021 03:23 AM
Thanks Viktor that helped
can you also help me to remove the data which contains / in the array.
i want to eliminite that completley
04-15-2021 05:49 AM
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('/', ''))