mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-10 02:02:30 +00:00
I have implemented most of the String.Concat overloads. The only ones that aren't implemented are the IEnumerable overloads
This commit is contained in:
parent
a0e0410c26
commit
537cf4502d
1 changed files with 47 additions and 4 deletions
|
|
@ -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)
|
||||
{
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue