summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--txr.126
2 files changed, 24 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index a84ea302..daea3034 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/txr.1 b/txr.1
index e4094d39..433c74c2 100644
--- a/txr.1
+++ b/txr.1
@@ -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.