diff options
author | Domen Kožar <domen@dev.si> | 2016-08-10 20:06:28 +0200 |
---|---|---|
committer | Domen Kožar <domen@dev.si> | 2016-08-10 20:06:52 +0200 |
commit | 221f7f18c150f92e6772c0b912c56692e1da519e (patch) | |
tree | 834eaa83c2566d003276b0dbaced72b6e3978f05 | |
parent | a4161ac355636551f5a3a441d388c7c0021b80f7 (diff) |
hasSuffix: human readable inputs
-rw-r--r-- | lib/strings.nix | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/strings.nix b/lib/strings.nix index daf845839343b..112165df82abe 100644 --- a/lib/strings.nix +++ b/lib/strings.nix @@ -156,12 +156,12 @@ rec { hasSuffix "foo" "barfoo" => true */ - hasSuffix = suff: str: + hasSuffix = suffix: content: let - lenStr = stringLength str; - lenSuff = stringLength suff; - in lenStr >= lenSuff && - substring (lenStr - lenSuff) lenStr str == suff; + lenContent = stringLength content; + lenSuffix = stringLength suffix; + in lenContent >= lenSuffix && + substring (lenContent - lenSuffix) lenContent content == suffix; /* Convert a string to a list of characters (i.e. singleton strings). This allows you to, e.g., map a function over each character. However, |