diff options
Diffstat (limited to 'DiscoBot/Auxiliary')
-rw-r--r-- | DiscoBot/Auxiliary/Extensions.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/DiscoBot/Auxiliary/Extensions.cs b/DiscoBot/Auxiliary/Extensions.cs index 2176129..a1d58fa 100644 --- a/DiscoBot/Auxiliary/Extensions.cs +++ b/DiscoBot/Auxiliary/Extensions.cs @@ -13,5 +13,20 @@ } 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; + } } } |