strutils2
internal API for now, subject to modifications and moving around
string API's focusing on performance, that can be used as building blocks for other routines.
Un-necessary allocations are avoided and appropriate algorithms are used at the expense of code clarity when justified.
Procs
proc dataPointer[T](a: T): pointer
- same as C++
data
that works with std::string, std::vector etc. Note: safe to use when a.len == 0 but whether the result is nil or not is implementation defined for performance reasons. Source Edit proc setLen(result: var string; n: int; isInit: bool) {...}{.raises: [], tags: [].}
- when isInit = false, elements are left uninitialized, analog to
{.noinit.}
else, there are 0-initialized. Source Edit proc forceCopy(result: var string; a: string) {...}{.raises: [], tags: [].}
- also forces a copy if
a
is shallow Source Edit proc toLowerAscii(a: var string) {...}{.raises: [], tags: [].}
- optimized and inplace overload of strutils.toLowerAscii Source Edit
© 2006–2021 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/compiler/strutils2.html