summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-07-19 19:19:21 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-07-19 19:19:21 -0700
commit8fe8e46c6dce8292f2c12660d0c383e521f9233a (patch)
tree347e192c467d2140b61ecc77356e18b544535fef /txr.1
parent5f9d1d22af102a8e9d2a769ea02243fb5763fe74 (diff)
downloadtxr-8fe8e46c6dce8292f2c12660d0c383e521f9233a.tar.gz
txr-8fe8e46c6dce8292f2c12660d0c383e521f9233a.tar.bz2
txr-8fe8e46c6dce8292f2c12660d0c383e521f9233a.zip
* lib.c (search_str): Support negative starting index.
Hoist uselessly repeated c_str operation out of loop. * txr.1: Document negative starting index for search-str.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.18
1 files changed, 6 insertions, 2 deletions
diff --git a/txr.1 b/txr.1
index 666d238c..b3f4b3b8 100644
--- a/txr.1
+++ b/txr.1
@@ -9337,8 +9337,12 @@ The search-str function finds an occurrence of the string <needle> inside
the <haystack> string and returns its position. If no such occurrence exists,
it returns nil.
-If a <start> argument is specified, it gives the starting index for the
-search. If the <from-end> argument is specified and is not nil, it means
+If a <start> argument is not specified, it defaults to zero. If it is
+a non-negative integer, it specifies the starting character position for
+the search. Negative values of <start> indicate positions from the end of the
+string, such that -1 is the last character of the string.
+
+If the <from-end> argument is specified and is not nil, it means
that the search is conducted right-to-left. If multiple matches are possible,
it will find the rightmost one rather than the leftmost one.