I have the next string:
AAAAAAA BBBBBBB BBBBBBB CCCCCCC CCCCCCC
I would like to have the next string:
AAAAAAA, BBBBBBB BBBBBBB, CCCCCCC CCCCCCC
Thank you if you could help my I only could do it with XPATH 1.0.
In XPath 1.0 we have to rely on translate() along with normalize-space() instead of the handy replace():
translate()
normalize-space()
replace()
translate(normalize-space(/),' ',',')
Online Demo
The downside of this approach is we can only translate to a single character, so no extra space after the comma. But for all intents and purposes, this should be cosmetic only.
Copyright © 2021 Jogjafile Inc.
In XPath 1.0 we have to rely on
translate()
along withnormalize-space()
instead of the handyreplace()
:Online Demo
The downside of this approach is we can only translate to a single character, so no extra space after the comma. But for all intents and purposes, this should be cosmetic only.