home contribute faq download

FunctX XQuery Functions

functx:lines

Split a string into separate lines

Google
Webdatypic.com

Description

The functx:lines function splits a string into individual lines, using the carriage return and newline characters to indicate the end of a line.

Arguments and Return Type

NameTypeDescription
$arg xs:string? the string to split
return value xs:string*

XQuery Function Declaration

See XSLT definition.
declare namespace functx = "http://www.functx.com";
declare function functx:lines
  ( $arg as xs:string? )  as xs:string* {

   tokenize($arg, '(\r\n?|\n\r?)')
 } ;

Examples

let $in-xml :=
<in-xml>a
value
on
many
lines</in-xml>
return
XQuery ExampleResults
functx:lines('a value')
a value
functx:lines($in-xml)
('a',
'value',
'on',
'many',
'lines')

See Also

functx:line-countThe number of lines
functx:max-line-lengthThe maximum line length

History

Published OnLast UpdatedContributor(s)
2006-07-092007-02-26Priscilla Walmsley, Datypic, pwalmsley@datypic.com, http://www.datypic.com
Datypic XQuery Services

Recommended Reading:

XQuery