This module supports helper routines for working with cstring
without having to convert cstring
to string
in order to save allocations.
proc startsWith(s, prefix: cstring): bool {...}{.noSideEffect, gcsafe, extern: "csuStartsWith", raises: [], tags: [].}
Returns true iff s
starts with prefix
.
If prefix == ""
true is returned.
proc endsWith(s, suffix: cstring): bool {...}{.noSideEffect, gcsafe, extern: "csuEndsWith", raises: [], tags: [].}
Returns true iff s
ends with suffix
.
If suffix == ""
true is returned.
proc cmpIgnoreStyle(a, b: cstring): int {...}{.noSideEffect, gcsafe, extern: "csuCmpIgnoreStyle", raises: [], tags: [].}
cmp(normalize($a), normalize($b))
. It is just optimized to not allocate temporary strings. This should NOT be used to compare Nim identifier names. use macros.eqIdent for that. Returns:0 iff a == b
< 0 iff a < b
> 0 iff a > b
proc cmpIgnoreCase(a, b: cstring): int {...}{.noSideEffect, gcsafe, extern: "csuCmpIgnoreCase", raises: [], tags: [].}
0 iff a == b
< 0 iff a < b
> 0 iff a > b
© 2006–2018 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/cstrutils.html