From 180bd65cd048c328dd8123fef7d0ba757d93a23c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Thu, 8 May 2014 13:07:02 +0200 Subject: [PATCH] lib/strings: simplify removePrefix readability It was discussed as a part of #2570. --- lib/strings.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/strings.nix b/lib/strings.nix index a903aa9fbc49..fa3cdd9711e4 100644 --- a/lib/strings.nix +++ b/lib/strings.nix @@ -155,8 +155,8 @@ rec { preLen = stringLength pre; sLen = stringLength s; in - if pre == substring 0 preLen s then - substring preLen (sub sLen preLen) s + if hasPrefix pre s then + substring preLen (sLen - preLen) s else s;