diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2014-02-01 16:08:58 -0800 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2014-02-01 16:08:58 -0800 |
commit | 8fa4401b20935ddc85bd160c82ce87c081d2f53b (patch) | |
tree | 5ed08251285a9ddb6e2e6909cef21494e277c6c7 /lib | |
parent | 200102580b77437857927e13fc40fdafe1642e8c (diff) | |
parent | d63eca96e5976f9125f89909b1e2db02b69654da (diff) | |
download | Nim-8fa4401b20935ddc85bd160c82ce87c081d2f53b.tar.gz |
Merge pull request #834 from gradha/pr_adds_strutils_const
Adds AllChars constant to strutils.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/strutils.nim | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim index de8dc5e51..b63224cec 100644 --- a/lib/pure/strutils.nim +++ b/lib/pure/strutils.nim @@ -45,6 +45,16 @@ const NewLines* = {'\13', '\10'} ## the set of characters a newline terminator can start with + AllChars* = {'\x00'..'\xFF'} + ## A set with all the possible characters. Not very useful by its own, you + ## can use it to create *inverted* sets to make the ``find()`` proc find + ## **invalid** characters in strings. Example: + ## + ## .. code-block:: nimrod + ## let invalid = AllChars - Digits + ## doAssert "01234".find(invalid) == -1 + ## doAssert "01A34".find(invalid) == 2 + proc toLower*(c: char): char {.noSideEffect, procvar, rtl, extern: "nsuToLowerChar".} = ## Converts `c` into lower case. This works only for the letters A-Z. |