summaryrefslogtreecommitdiff
path: root/DiscoBot/Auxiliary/Extensions.cs
diff options
context:
space:
mode:
authorTrueDoctor <d-kobert@web.de>2018-06-11 18:28:13 +0200
committerTrueDoctor <d-kobert@web.de>2018-06-11 18:28:13 +0200
commitaf937e7a8519ea3b06be651eb21b54132295c510 (patch)
tree17dbc28a5e9a75a1a42813a233b1c41390e673c4 /DiscoBot/Auxiliary/Extensions.cs
parentad4cb92819976b8add36f047e59335104aa171fe (diff)
parentff80592d541c79653ef0a7c04e0938d7249069ef (diff)
Merge branch 'master' of https://github.com/TrueDoctor/DiscoBot
Diffstat (limited to 'DiscoBot/Auxiliary/Extensions.cs')
-rw-r--r--DiscoBot/Auxiliary/Extensions.cs32
1 files changed, 32 insertions, 0 deletions
diff --git a/DiscoBot/Auxiliary/Extensions.cs b/DiscoBot/Auxiliary/Extensions.cs
new file mode 100644
index 0000000..a1d58fa
--- /dev/null
+++ b/DiscoBot/Auxiliary/Extensions.cs
@@ -0,0 +1,32 @@
+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;
+ }
+
+
+
+ //This mehod extends string.
+ //It adds spaces at the HEAD of a string until a fixed length is reached.
+ //If the original string is already longer, it is returner unmodified.
+ public static string AddSpacesAtHead(this string str, int length)
+ {
+ string temp = "";
+ for (int i = str.Length; i < length; i++)
+ {
+ temp += " ";
+ }
+ return temp + str;
+ }
+ }
+}