mirror of
https://github.com/twiglet/cs2j.git
synced 2025-01-18 13:15:17 +01:00
move csfmttojavafmt to stringsupport
This commit is contained in:
parent
2aa89a54d9
commit
32c3ae4b6c
@ -28,9 +28,9 @@
|
||||
</Method>
|
||||
<Method>
|
||||
<Imports>
|
||||
<Import>CS2JNet.System.ConsoleSupport</Import>
|
||||
<Import>CS2JNet.System.StringSupport</Import>
|
||||
</Imports>
|
||||
<Java>System.out.printf(ConsoleSupport.CSFmtStrToJFmtStr(${fmt}), ${arg})</Java>
|
||||
<Java>System.out.printf(StringSupport.CSFmtStrToJFmtStr(${fmt}), ${arg})</Java>
|
||||
<Params>
|
||||
<Param>
|
||||
<Type>System.String</Type>
|
||||
@ -46,9 +46,9 @@
|
||||
</Method>
|
||||
<Method>
|
||||
<Imports>
|
||||
<Import>CS2JNet.System.ConsoleSupport</Import>
|
||||
<Import>CS2JNet.System.StringSupport</Import>
|
||||
</Imports>
|
||||
<Java>System.out.printf(ConsoleSupport.CSFmtStrToJFmtStr(${fmt}), ${arg1}, ${arg2})</Java>
|
||||
<Java>System.out.printf(StringSupport.CSFmtStrToJFmtStr(${fmt}), ${arg1}, ${arg2})</Java>
|
||||
<Params>
|
||||
<Param>
|
||||
<Type>System.String</Type>
|
||||
@ -87,9 +87,9 @@
|
||||
</Method>
|
||||
<Method>
|
||||
<Imports>
|
||||
<Import>CS2JNet.System.ConsoleSupport</Import>
|
||||
<Import>CS2JNet.System.StringSupport</Import>
|
||||
</Imports>
|
||||
<Java>System.out.printf(ConsoleSupport.CSFmtStrToJFmtStr(${fmt}) + "\\n", ${arg})</Java>
|
||||
<Java>System.out.printf(StringSupport.CSFmtStrToJFmtStr(${fmt}) + "\\n", ${arg})</Java>
|
||||
<Params>
|
||||
<Param>
|
||||
<Type>System.String</Type>
|
||||
@ -105,9 +105,9 @@
|
||||
</Method>
|
||||
<Method>
|
||||
<Imports>
|
||||
<Import>CS2JNet.System.ConsoleSupport</Import>
|
||||
<Import>CS2JNet.System.StringSupport</Import>
|
||||
</Imports>
|
||||
<Java>System.out.printf(ConsoleSupport.CSFmtStrToJFmtStr(${fmt}) + "\\n", ${arg1}, ${arg2})</Java>
|
||||
<Java>System.out.printf(StringSupport.CSFmtStrToJFmtStr(${fmt}) + "\\n", ${arg1}, ${arg2})</Java>
|
||||
<Params>
|
||||
<Param>
|
||||
<Type>System.String</Type>
|
||||
|
@ -23,15 +23,5 @@ package CS2JNet.System;
|
||||
|
||||
public class ConsoleSupport {
|
||||
|
||||
// Takes a C# format string and vonverts it to a Java format string
|
||||
public static String CSFmtStrToJFmtStr(String fmt)
|
||||
{
|
||||
return fmt.replaceAll("\\{(\\d)+\\}", "%$1\\$s");
|
||||
}
|
||||
|
||||
public static void testMain(String[] args)
|
||||
{
|
||||
System.out.printf(CSFmtStrToJFmtStr("DECLARATION: {0}={1}") + "\n", "Kevin", "Great");
|
||||
System.out.printf(CSFmtStrToJFmtStr("DECLARATION: {0}={1}"), "Kevin", "Great");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -361,7 +361,14 @@ public class StringSupport {
|
||||
}
|
||||
return new String(chars);
|
||||
}
|
||||
|
||||
|
||||
// Takes a C# format string and converts it to a Java format string
|
||||
public static String CSFmtStrToJFmtStr(String fmt)
|
||||
{
|
||||
return fmt.replaceAll("\\{(\\d)+\\}", "%$1\\$s");
|
||||
}
|
||||
|
||||
|
||||
public static void Testmain(String[] args)
|
||||
{
|
||||
System.out.println("**" + Trim("") + "**");
|
||||
@ -395,8 +402,14 @@ public class StringSupport {
|
||||
System.out.println("Split(\"fred=5\", '=') = [\"" + splitFred[0] + "\", \"" + splitFred[1] + "\"]");
|
||||
splitFred = Split("=fred",'=');
|
||||
System.out.println("Split(\"=fred\", '=') = [\"" + splitFred[0] + "\", \"" + splitFred[1] + "\"]");
|
||||
|
||||
System.out.printf(CSFmtStrToJFmtStr("DECLARATION: {0}={1}") + "\n", "Kevin", "Great");
|
||||
System.out.printf(CSFmtStrToJFmtStr("DECLARATION: {0}={1}"), "Kevin", "Great");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Testmain(args);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user