[Nix-dev] Basic string functions in nixops

Utku Demir utdemir at gmail.com
Mon Jan 25 18:00:47 CET 2016


I usually check .nix files in "
https://github.com/NixOS/nixpkgs/tree/master/lib" folder when searching for
basic functions. String manipulation functions are in "strings.nix".

On your case, this should work:

nix-repl> with (import <nixpkgs/lib>); concatStrings (take 16
(stringToCharacters "0123456789abcdefghijklmnop"))
"0123456789abcdef"

On Mon, 25 Jan 2016 at 18:16 4levels <4levels at gmail.com> wrote:

> Dear Nix Devs,
>
> I'm currently looking (again) for the basic string functions.
> Use case: I need to limit a parametric string's length to maximum 16
> characters (indeed, MySql usernames cannot be longer than 16 characters).
>
> Any hints in the right direction to substring a string in case it is
> longer than 16 chars are greatly appreciated ;-)
>
> Kind regards,
>
> Erik aka 4levels
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160125/1ce14e21/attachment-0001.html 


More information about the nix-dev mailing list