From 8d19ba919585b751a78f32d74acf33739c19284d Mon Sep 17 00:00:00 2001 From: Major Taylor Date: Sun, 15 Mar 2020 02:49:37 -0400 Subject: [PATCH] string: strip_margin: fix the error message for multiple args --- vlib/builtin/string.v | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vlib/builtin/string.v b/vlib/builtin/string.v index 6296ea3531..90fa0f7efe 100644 --- a/vlib/builtin/string.v +++ b/vlib/builtin/string.v @@ -1288,15 +1288,15 @@ pub fn (s string) strip_margin(del ...byte) string { // Only care about the first one, ignore the rest if more for d in del { // The delimiter is not allowed to be white-space. Will use default - if !d.is_space() { - sep = d - } else { + if d.is_space() { eprintln("Warning: `strip_margin` cannot use white-space as a delimiter") eprintln(" Defaulting to `|`") + } else { + sep = d } break } - if del.len == 1 { + if del.len != 1 { eprintln("Warning: `strip_margin` only uses the first argument given") } }