2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-02 23:15:20 +00:00

[#2272] Added split function to expression syntax

doc/sphinx/arm/classify.rst
    Documented new split() function

src/lib/eval/eval_messages.cc b/src/lib/eval/eval_messages.*
    New debug log messges

src/lib/eval/lexer.ll
src/lib/eval/parser.yy
    added split parsing

src/lib/eval/tests/token_unittest.cc
    Added tests for split()

src/lib/eval/token.*
    Added TokenSplit class
This commit is contained in:
Thomas Markwalder
2022-04-14 07:21:12 -04:00
committed by Razvan Becheriu
parent 2404bd82a2
commit 29988a24e2
13 changed files with 2857 additions and 2766 deletions

View File

@@ -474,6 +474,10 @@ Notes:
| | | a hexadecimal string, |
| | | e.g. 0a:1b:2c:3e |
+-----------------------+-------------------------+-----------------------+
| Split | split('foo.bar','.',2) | Return the second |
| | | field, splitting on |
| | | dots. |
+-----------------------+-------------------------+-----------------------+
.. table:: List of conversion-to-text expressions
@@ -586,6 +590,25 @@ or:
'abcdefghijkl...'
Split
---------
The Split operator ``Split(value, delimiters, field-number)`` accepts a list
of characters to use as delimiters and a positive field number of the
desired field when the value is split into fields separated by the delimiters.
Adjacent delimit are not compressed out, rather they result in
an empty string for that field number. If value is an empty string, the result
will an empty string. If the delimiters list is empty, the result will be the
original value. If the is less than one or larger than the number of fields,
the result will be an empty string. Some examples follow:
::
split ('one.two..four', '.', 1) == 'one'
split ('one.two..four', '.', 2) == 'two'
split ('one.two..four', '.', 3) == ''
split ('one.two..four', '.', 4) == 'four'
split ('one.two..four', '.', 5) == ''
Ifelse
------