mirror of
https://github.com/twiglet/cs2j.git
synced 2025-01-18 13:15:17 +01:00
support for new String('x',5) === "xxxxx"
This commit is contained in:
parent
749a91af39
commit
f718a71970
@ -14,16 +14,19 @@
|
|||||||
<Constructors>
|
<Constructors>
|
||||||
<Constructor>
|
<Constructor>
|
||||||
<Params>
|
<Params>
|
||||||
<Param>
|
|
||||||
<Name>length</Name>
|
|
||||||
<Type>System.Int32</Type>
|
|
||||||
</Param>
|
|
||||||
<Param>
|
<Param>
|
||||||
<Name>char</Name>
|
<Name>char</Name>
|
||||||
<Type>System.Char</Type>
|
<Type>System.Char</Type>
|
||||||
</Param>
|
</Param>
|
||||||
|
<Param>
|
||||||
|
<Name>length</Name>
|
||||||
|
<Type>System.Int32</Type>
|
||||||
|
</Param>
|
||||||
</Params>
|
</Params>
|
||||||
<Java>new String(${length}, ${char}) /* FIX ME */</Java>
|
<Imports>
|
||||||
|
<Import>RusticiSoftware.System.StringSupport</Import>
|
||||||
|
</Imports>
|
||||||
|
<Java>StringSupport.mkString(${char}, ${length})</Java>
|
||||||
</Constructor>
|
</Constructor>
|
||||||
<Constructor>
|
<Constructor>
|
||||||
<Params>
|
<Params>
|
||||||
|
@ -338,6 +338,15 @@ public class StringSupport {
|
|||||||
}
|
}
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// in C# new String('x',50)
|
||||||
|
public static String mkString(char c, int count) {
|
||||||
|
char[] chars = new char[count];
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
chars[i] = c;
|
||||||
|
}
|
||||||
|
return new String(chars);
|
||||||
|
}
|
||||||
|
|
||||||
public static void Testmain(String[] args)
|
public static void Testmain(String[] args)
|
||||||
{
|
{
|
||||||
@ -373,5 +382,7 @@ public class StringSupport {
|
|||||||
splitFred = Split("=fred",'=');
|
splitFred = Split("=fred",'=');
|
||||||
System.out.println("Split(\"=fred\", '=') = [\"" + splitFred[0] + "\", \"" + splitFred[1] + "\"]");
|
System.out.println("Split(\"=fred\", '=') = [\"" + splitFred[0] + "\", \"" + splitFred[1] + "\"]");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user