diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | txr.1 | 26 |
2 files changed, 24 insertions, 8 deletions
@@ -1,3 +1,9 @@ +2013-05-20 Kaz Kylheku <kaz@kylheku.com> + + * txr.1: Misleading documentation updated for split-str, which + takes a regex, not just a fixed string separator. Clarified + the corner case behaviors too. + 2013-05-16 Kaz Kylheku <kaz@kylheku.com> Version 66 @@ -7514,14 +7514,24 @@ Syntax: Description: The split-str function breaks the <string> into pieces, returing a list -thereof. The <sep> argument must be a string. It specifies the separator -character sequence within <string>. All non-overlapping occurences of -<sep> within <string> are identified in left to right order, and are removed -from <string>. The string is broken into pieces according to the gaps left -behind by the removed separators. - -Adjacent occurrences of <sep> within <string> are considered to be separate -gaps which come between empty strings. +thereof. The <sep> argument must be either a string or a regular expression. +It specifies the separator character sequence within <string>. + +All non-overlapping matches for <sep> within <string> are identified in left +to right order, and are removed from <string>. The string is broken into pieces +according to the gaps left behind by the removed separators, and a list +of the remaining pieces is returned. + +If a match for <sep> is not found in the string at all, then the string is not +split at all: a list of one element is returned containing the original +string. + +If <sep> matches the entire string, then a list of two empty strings is +returned, except in the case that the original string is empty, in which case a +list of one element is returned, containing the empty string. + +Whenever two adjacent matches for <sep> occur, they are considered separate +cuts with an empty piece between them. This operation is nondestructive: <string> is not modified in any way. |