From 19fd05a2990ec309a3869d61a6bcf48aba4793dd Mon Sep 17 00:00:00 2001 From: Kobert-P Date: Sun, 10 Jun 2018 01:17:57 +0200 Subject: AddSpaces extension --- DiscoBot/Auxiliary/Extensions.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 DiscoBot/Auxiliary/Extensions.cs (limited to 'DiscoBot/Auxiliary/Extensions.cs') diff --git a/DiscoBot/Auxiliary/Extensions.cs b/DiscoBot/Auxiliary/Extensions.cs new file mode 100644 index 0000000..2176129 --- /dev/null +++ b/DiscoBot/Auxiliary/Extensions.cs @@ -0,0 +1,17 @@ +namespace DiscoBot.Auxiliary +{ + public static class StringExtension + { + //This mehod extends string. It adds spaces until a fixed length is reached. + //If the original string is already longer, it is returner unmodified. + public static string AddSpaces(this string str, int length) + { + string temp = str; + for(int i = str.Length; i < length; i++) + { + temp += " "; + } + return temp; + } + } +} -- cgit v1.2.3-54-g00ecf