| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
--styleCheck:error
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* make parsutils.parseBin generic and improve runnableExamples
* reimplement parseBin/Oct/Hex and improve runnableExamples
* update changelog.md file with parseBin/Oct/Hex and fix a typo
* delete template and code parseBin|Oct|Hex separately
* split definitions between int and other SomeInteger
* make parseBin|Oct|Hex generic and remove rtl pragmas
* remove pragma inline from praseBin|Oct|Hex
* implement families of parse(Bin|Oct|Hex)Int[xx]
* fix typo [skip ci]
* implement generic fromBin|Oct|Hex
* make runnableExamples shorter
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* wip documentation strutils
* some runnableExamples in strutils
* assert -> doAssert
* corrected doc for abbrev; some more runnable examples
* runnableExamples for join
* fix c&p error
* corrections
|
| |
|
| |
|
| |
|
|
|
|
| |
#6301
|
|
|
|
| |
strings; fixes #7963 properly
|
| |
|
|
|
|
|
|
| |
* Proposed solution for issue #8919
* count sub/subs must be non-empty
|
| |
|
|
|
| |
Fixes #8865
|
| |
|
|\ |
|
| | |
|
| | |
|
|/ |
|
|
|
|
|
|
| |
* Testament should run tests with no action
* Fix strutils tests for JS
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* clarify `parseHexInt`, `parseOctInt` docstring and exception msgs
* add `parseBinInt` based on `parseutil.parseBin` implementation
Adds a `parseBinInt`, which parses a binary integer string and returns
it as an integer. This is based on the implementation of
`parseutil.parseBin`, removing the unnecessary parts.
* add tests for all `parse(Hex|Oct|Bin)Int` procs
* replace `parse*Int` proc impls by call to parseutil procs
Replaces the `parse(Hex|Oct|Bin)Int` procedure implementation by calls
to the `parseutil` procs, which receive a mutable argument.
Has the main advantage that the empty string as well as a "prefix
only" string, e.g. "0x" counts as an invalid integer.
Also moves the `parseOctInt` proc further up in the file so that all
`parse` procs are below one another.
* replace `var L` by `let L` in `parse` procs
There's no reason for the usage of `var` here.
* add `maxLen` optional arg for `parseutil.parse(Oct|Bin)`
Plus small change to test cases.
* update changelog about `parse*Int` procs
* fix `rejectParse` template in `tstrutils`
* make sure only `s.len` chars are parsed, if `maxLen+start` > s.len
Fixes a previous bug in `parseHex` (and now affected `parseOct` and
`parseBin`), which allowed to set `start + maxLen` to be larger than
the strings length. This resulted in an out of bounds access.
* move `parse*Int` proc change to breaking changes, add double `
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The other variants are isLower, isUpperAscii and isLowerAscii
Fixes https://github.com/nim-lang/Nim/issues/7963.
This commit changes the behavior and signatures of:
- isUpper, isLower in the unicode module
- isUpperAscii, isLowerAscii in the strutils module
A second mandatory parameter skipNonAlpha is added to these 4 procs.
(This change affects only for the case where the input is a *string*.)
---
With skipNonAlpha set to true, the behavior mimics the Python isupper and
islower behavior i.e. non-alphabetic chars/runes are ignored when checking if
the string is upper-case or lower-case.
Before this commit:
doAssert(not isUpper("A B"))
After this commit:
doAssert(not isUpper("A B", false)) <-- old behavior
doAssert isUpper("A B", true)
Below two are equivalent:
isUpper("A B", true)
isAlpha("A B") and isUpper("A B", false)
.. and the similar for other 3 procs.
|
|
|
|
| |
(#7928)
|
|
|
|
|
|
|
|
|
|
|
|
| |
For some reason, the problem was manifesting only inside the VM, it was
detecting an attempt to read past the string end (i.e. the formerly
accessible null byte).
To catch such errors, strutils now performs static tests too.
I've solved the problem by re-implementing the Boyer-Moore algotihm
in a cleaner way and I took the opportunity to make some other
optimisations to strutils.
|
| |
|
| |
|
| |
|
| |
|