From 2ab4051c6fe720dc47e99b0c305a0d779ee02d51 Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Sun, 19 May 2019 17:58:42 +0200 Subject: Moved Gamelogic to DSALib --- DSALib/Auxiliary/Extensions.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 DSALib/Auxiliary/Extensions.cs (limited to 'DSALib/Auxiliary/Extensions.cs') diff --git a/DSALib/Auxiliary/Extensions.cs b/DSALib/Auxiliary/Extensions.cs new file mode 100644 index 0000000..f8e9d8e --- /dev/null +++ b/DSALib/Auxiliary/Extensions.cs @@ -0,0 +1,25 @@ +namespace DSACore.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) + { + var temp = str; + for (var 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) + { + var temp = ""; + for (var i = str.Length; i < length; i++) temp += " "; + return temp + str; + } + } +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf