lib.removePrefix: Optimise

This commit is contained in:
Silvan Mosberger 2023-08-14 23:29:18 +02:00
parent 8fab18d4c1
commit 150217c1ac

View File

@ -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);