summaryrefslogtreecommitdiff
path: root/dsa/DSALib/Auxiliary/Extensions.cs
diff options
context:
space:
mode:
authorDennis Kobert <d-kobert@web.de>2019-06-11 23:38:13 +0200
committerDennis Kobert <d-kobert@web.de>2019-06-11 23:38:13 +0200
commit2fa4a0e50ebfc97059c8b84dbd17e79f9afc8a8d (patch)
treec3b34ccb2737e347a73768536895cbbaab13cc01 /dsa/DSALib/Auxiliary/Extensions.cs
parentec991104f56e90d7bb2878da2fe6ed4e585dfc46 (diff)
parentaf74efccf8d21e6151022b71f3cacd3fa83024ee (diff)
Merge branch 'rework-backend'
Diffstat (limited to 'dsa/DSALib/Auxiliary/Extensions.cs')
-rw-r--r--dsa/DSALib/Auxiliary/Extensions.cs25
1 files changed, 25 insertions, 0 deletions
diff --git a/dsa/DSALib/Auxiliary/Extensions.cs b/dsa/DSALib/Auxiliary/Extensions.cs
new file mode 100644
index 0000000..7d367a5
--- /dev/null
+++ b/dsa/DSALib/Auxiliary/Extensions.cs
@@ -0,0 +1,25 @@
+namespace DSALib.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