# cstrutils

- マニュアル
- 標準ライブラリ
- 索引

検索
分類:

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: [].}

  Semantically the same as `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: [].}

  Compares two strings in a case insensitive manner. Returns:

  0 iff a == b
  < 0 iff a < b
  > 0 iff a > b

  ソース 編集