mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-25 20:34:52 +03:00
lib.removePrefix: Optimise
This commit is contained in:
parent
8fab18d4c1
commit
150217c1ac
@ -629,10 +629,10 @@ rec {
|
||||
This behavior is deprecated and will throw an error in the future.''
|
||||
(let
|
||||
preLen = stringLength prefix;
|
||||
sLen = stringLength str;
|
||||
in
|
||||
if substring 0 preLen str == prefix then
|
||||
substring preLen (sLen - preLen) str
|
||||
# -1 will take the string until the end
|
||||
substring preLen (-1) str
|
||||
else
|
||||
str);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user