Hi Guys.
Im trying to make a function where the string contains half-width and full-width spaces, the first and last spaces will be removed.
When i used the trim() function in appian it only trim(beginning and trail) half width spaces but if the spaces are full width it will not trim.
so i tried to trim and use the substitute function like this:
trim(substitute(ri!value," "," " )).
It does trim the value perfectly, but it will also substitute the spaces in between the value where it shouldnt be.
Example process:
"<full-wdith spaces>he<full-wdith spaces>ll<full-wdith spaces>"
after executing the process: trim(substitute(ri!value," "," " ))
result: "he<half wdith space>ll"
expected output should be : "he<full-wdith spaces>ll"
Do you have any other idea to perform the desired process?
Thank You guys
Discussion posts and replies are publicly visible
From a typography perspective I fully understand what you try to do, but what is the use case?
Did you consider using a regex? Something similar to this: stackoverflow.com/.../regex-to-replace-multiple-spaces-with-a-single-space
Hi Stefan,
I tried to used this function in appian and with this regex code value, that replaced leading and trailing spaces to "".
regexreplaceall("^\s+|\s+$", ri!targetValue, "")
However when the value consist of fullwidth space like this " " -> unicode equilavent to 12288
Normal half width space is unicode 32.
It only removes half width space., even using trim function in appian only removes half width space.
So Im having problem on how to removed also the full width spaces.
I am really interested in your use case. Where do these fullwidth spaces come from?
You will need to modify the regex to your requirements.
Yes, Im still looking for regex code equivalent for fullwidth spaces.
But do you have any suggestion or like other process to remove spaces including half and full width, Sir?
Full Width spaces/characters are used in Japanese text.
stackoverflow.com/.../unicode-characters-in-regex
I got it now, Thanks :). Since Appian uses Java regex flavor, all i need is to add the embedded (?U) flag option to the pattern.
So my regex code looks like this: regexreplaceall("(?U)^\s+|\s+$", ri!targetValue, "") .
works like magic haha