From fc77a752b41ea7c37d9ec4a49f410ea7468b19d5 Mon Sep 17 00:00:00 2001 From: ig Date: Thu, 14 Sep 2023 14:24:20 +0200 Subject: [PATCH] add EnsureEndsWith --- csharp/Lib/Utils/StringUtils.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/csharp/Lib/Utils/StringUtils.cs b/csharp/Lib/Utils/StringUtils.cs index 774706efe..284d43cf8 100644 --- a/csharp/Lib/Utils/StringUtils.cs +++ b/csharp/Lib/Utils/StringUtils.cs @@ -375,6 +375,11 @@ public static class StringUtils { return $"{prefix}{target.TrimStart(prefix)}"; } + + public static String EnsureEndsWith(this String target, String postfix) + { + return $"{target.TrimEnd(postfix)}{postfix}"; + } } \ No newline at end of file