mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 16:33:15 +00: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