mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 12:53:59 +03:00
hasSuffix: human readable inputs
This commit is contained in:
parent
a4161ac355
commit
221f7f18c1
@ -156,12 +156,12 @@ rec {
|
|||||||
hasSuffix "foo" "barfoo"
|
hasSuffix "foo" "barfoo"
|
||||||
=> true
|
=> true
|
||||||
*/
|
*/
|
||||||
hasSuffix = suff: str:
|
hasSuffix = suffix: content:
|
||||||
let
|
let
|
||||||
lenStr = stringLength str;
|
lenContent = stringLength content;
|
||||||
lenSuff = stringLength suff;
|
lenSuffix = stringLength suffix;
|
||||||
in lenStr >= lenSuff &&
|
in lenContent >= lenSuffix &&
|
||||||
substring (lenStr - lenSuff) lenStr str == suff;
|
substring (lenContent - lenSuffix) lenContent content == suffix;
|
||||||
|
|
||||||
/* Convert a string to a list of characters (i.e. singleton strings).
|
/* 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,
|
This allows you to, e.g., map a function over each character. However,
|
||||||
|
Loading…
Reference in New Issue
Block a user