我需要使用replace()函数在XQuery中用一个破折号替换多个空白字符。
$input: 'abc def 123'
Desired Output: 'abc-def-123'
Run Code Online (Sandbox Code Playgroud)
我试过:
replace($input, '/s*', '-')
Run Code Online (Sandbox Code Playgroud)
和
replace($input, '/s.*', '-')
Run Code Online (Sandbox Code Playgroud)
但这些都不起作用。我知道 normalize-space() 但我想要一个更通用的函数。
谢谢!- 丹