W3cubDocs

/Nim

Module strmisc

This module contains various string utility routines that are uncommonly used in comparison to strutils.

Imports

strutils

Procs

proc expandTabs(s: string; tabSize: int = 8): string {...}{.noSideEffect, procvar, raises: [],
    tags: [].}
Expand tab characters in s by tabSize spaces
proc partition(s: string; sep: string; right: bool = false): (string, string, string) {...}{.
    noSideEffect, procvar, raises: [], tags: [].}

Split the string at the first or last occurrence of sep into a 3-tuple

Returns a 3 string tuple of (beforeSep, sep, afterSep) or (s, "", "") if sep is not found and right is false or ("", "", s) if sep is not found and right is true

proc rpartition(s: string; sep: string): (string, string, string) {...}{.noSideEffect,
    procvar, raises: [], tags: [].}

Split the string at the last occurrence of sep into a 3-tuple

Returns a 3 string tuple of (beforeSep, sep, afterSep) or ("", "", s) if sep is not found

© 2006–2018 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/strmisc.html