src/sys/private/strsliceutils

Source   Edit  

General purpose string utilities that returns slices.

TODO: This needs to be spun off into a project of its own

Procs

func add(s: var string; buf: openArray[char]) {....raises: [], tags: [],
    forbids: [].}
Append characters in buf to s. Source   Edit  

Iterators

iterator splitSlices(s: string; chars: set[char]): Slice[int] {....raises: [],
    tags: [], forbids: [].}

A split iterator that yields slices of the input instead of copies of those slices.

If chars is not found in s, the full range of the string is yielded.

Only yields if s is not empty.

Source   Edit  

Templates

template slice(s: string; slice: HSlice[int, BackwardsIndex]): untyped
Shorter alias for toOpenArray(s, start, end) Source   Edit  
template slice(s: string; slice: Slice[int]): untyped
Shorter alias for toOpenArray(s, start, end) Source   Edit