query
On this page

substring

builtins.substring

Primop
Docs pulled from | This Revision | about 13 hours ago

Takes 3 arguments

start, len, s


Return the substring of s from byte position start (zero-based) up to but not including start + len. If start is greater than the length of the string, an empty string is returned. If start + len lies beyond the end of the string or len is -1, only the substring up to the end of the string is returned. start must be non-negative. For example,

builtins.substring 0 3 "nixos"

evaluates to "nix".

This function is not defined in a .nix file. It is likely a builtins function or an alias of a builtins function. builtins functions are predefined functions provided by Nix.

Noogle detected

Aliases

Detected Type
substring :: Int -> Int -> String -> String

Implementation

This function is implemented in c++ and is part of the native nix runtime.