This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 29357 - Treat string as array
Summary: Treat string as array
Status: NEW
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Requirements for Future Versions (show other bugs)
Version: Working drafts
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Jim Melton
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-03 23:20 UTC by Benito van der Zander
Modified: 2016-01-03 23:20 UTC (History)
0 users

See Also:


Attachments

Description Benito van der Zander 2016-01-03 23:20:34 UTC
Strings are basically lists of characters. But in XQuery it is hard to access the individual characters and you cannot use sequence manipulation on the string. string-to-codepoints is way too long to type. You could not treat the string as sequence, as they could not nest, but now there are arrays and you can treat the string as array:

"string"(3)   becomes r

"string"?*    becomes ("s", "t", "r", "i", "n", "g")

Then you can use all the sequence stuff on it. ("string"?*)[. > "n"]=>reverse()=>string-join() and get "ts"

The NCName could be an contains test. "string"?str = true(), "string"?xxx = false()
Or a some matching. Would be more general. "string"?str = "string", "string"?tr = "tring", "string"?ing = "ing", "string"?xxx = ""

Perhaps also remove the silly FORX0003 and let tokenize("string", "") = "string"?*

Too bad  it is too late to make string-join(tokenize($foo)) = $foo