New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[XPath] Functions that determine if a given sequence starts with another sequence or ends with another sequence #96
Comments
Note workarounds such as
|
And for all(for-each-pair(reverse($A), reverse($B), my:compare#2)) However this is rather challenging to read and understand. Thanks god, for strings we have all(for-each-pair(string-to-codepoints($A), string-to-codepoints($B), my:compare#2) and all(for-each-pair(reverse(string-to-codepoints($A)), reverse(string-to-codepoints($B)), my:compare#2) Some of us can treat this as a problem, spend some time and find a suitable XPath expression. The whole meaning of this proposal is that doing this will no longer be a problem for anyone. This proposal aims at achieving conceptual integrity, simplicity, readability and easy understandability / convenience |
The issue can now be closed, PR #222 was accepted on 2022-11-01 |
It is surprising that we are at version 4 and still are missing:
and
(2) above is a shorthand for:
Examples:
fn:starts-with-sequence(('a', 'b', 'c', 'd'), ('a', 'b'))
returnstrue()
fn:starts-with-sequence(('a', 'b', 'c', 'd'), ('a', 'c'))
returnsfalse()
fn:ends-with-sequence(('a', 'b', 'c', 'd'), ('c', 'd'))
returnstrue()
fn:ends-with-sequence(('a', 'b', 'c', 'd'), ('b', 'd'))
returnsfalse()
('a', 'b', 'c', 'd') => starts-with-sequence(('a', 'b'))
returnstrue()
('a', 'b', 'c', 'd') => starts-with-sequence(('a', 'c'))
returnsfalse()
('a', 'b', 'c', 'd') => ends-with-sequence(('c', 'd'))
returnstrue()
('a', 'b', 'c', 'd') => ends-with-sequence(('b', 'd'))
returnsfalse()
One possible implementation:
The text was updated successfully, but these errors were encountered: