Description
The functx:camel-case-to-words function turns a camel-case string (one that uses upper-case letters to start new words, as in "thisIsACamelCaseTerm"), and turns them into a string of words using a space or other delimiter.
Arguments and Return TypeName | Type | Description |
$arg |
xs:string? |
the string to modify |
$delim |
xs:string |
the delimiter for the words (e.g. a space) |
return value |
xs:string |
XQuery Function DeclarationSee XSLT definition. | declare namespace functx = "http://www.functx.com";
declare function functx:camel-case-to-words
( $arg as xs:string? ,
$delim as xs:string ) as xs:string {
concat(substring($arg,1,1),
replace(substring($arg,2),'(\p{Lu})',
concat($delim, '$1')))
} ; |
ExamplesXQuery Example | Results |
---|
functx:camel-case-to-words(
'thisIsACamelCaseTerm',' ') |
this Is A Camel Case Term |
functx:camel-case-to-words(
'thisIsACamelCaseTerm',',') |
this,Is,A,Camel,Case,Term |
See AlsoHistory |
Recommended Reading:
|