From 537cf4502d1898cb7105160f193eeea3ee899e26 Mon Sep 17 00:00:00 2001 From: Cman332_cp Date: Fri, 30 Dec 2011 03:35:23 +0000 Subject: [PATCH] I have implemented most of the String.Concat overloads. The only ones that aren't implemented are the IEnumerable overloads --- .../CustomImplementation/System/StringImpl.cs | 51 +++++++++++++++++-- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/source2/IL2CPU/Cosmos.IL2CPU/CustomImplementation/System/StringImpl.cs b/source2/IL2CPU/Cosmos.IL2CPU/CustomImplementation/System/StringImpl.cs index 1d66e32bd..02058cad1 100644 --- a/source2/IL2CPU/Cosmos.IL2CPU/CustomImplementation/System/StringImpl.cs +++ b/source2/IL2CPU/Cosmos.IL2CPU/CustomImplementation/System/StringImpl.cs @@ -38,12 +38,55 @@ namespace Cosmos.IL2CPU.CustomImplementation.System Console.WriteLine("String.StartsWith not working!"); throw new NotImplementedException(); } - - public static string Concat(string a, string b, string c) + //String concatenation plugs + public static string Concat(string str0, string str1, string str2) { - return ConcatArray(new string[] { a, b, c }, a.Length + b.Length + c.Length); + return ConcatArray(new string[] { str0, str1, str2 }, str0.Length + str1.Length + str2.Length); + } + public static string Concat(string str0, string str1) + { + return ConcatArray(new string[] { str0, str1 }, str0.Length + str1.Length); + } + public static string Concat(string str0, string str1, string str2, string str3) + { + return ConcatArray(new string[] { str0, str1, str2, str3 }, str0.Length + str1.Length + str2.Length + str3.Length); + } + //Object concatenation plugs + public static string Concat(object obj0) + { + return obj0.ToString(); + } + public static string Concat(object obj0, object obj1) + { + return Concat(obj0.ToString(),obj1.ToString(); + } + public static string Concat(object obj0, object obj1, object obj2) + { + return Concat(obj0.ToString(), obj1.ToString(), obj2.ToString()); + } + public static string Concat(object obj0, object obj1, object obj2, object obj3) + { + return Concat(obj0.ToString(), obj1.ToString(), obj2.ToString(), obj3.ToString()); + } + //Array concatenation plugs + public static string Concat(params string[] values) + { + int len = 0; + for (int i = 0; i < values.Length; i++) + { + len += values[i].Length; + } + return ConcatArray(values, len); + } + public static string Concat(params object[] args) + { + string[] values = new string[args.Length]; + for (int i = 0; i < args.Length; i++) + { + values[i] = args[i].ToString(); + } + return Concat(values); } - public static string ConcatArray(string[] values, int totalLength) {