diff --git a/CS2JLibrary/NetTranslations/System/Text/StringBuilder.xml b/CS2JLibrary/NetTranslations/System/Text/StringBuilder.xml
index 37749a6..e9f0077 100755
--- a/CS2JLibrary/NetTranslations/System/Text/StringBuilder.xml
+++ b/CS2JLibrary/NetTranslations/System/Text/StringBuilder.xml
@@ -24,7 +24,16 @@
Length
System.Int32
${this}.length()
- ${this}.setlength(${value})
+ StringBuilderSupport.setLength(${this}, ${value})
+
+ RusticiSoftware.System.Text.StringBuilderSupport
+
+
+
+ Capacity
+ System.Int32
+ ${this}.capacity()
+ ${this}.ensureCapacity(${value})
@@ -50,6 +59,20 @@
${this}.append((${arg}) + System.getProperty("line.separator"))
+
+ System.Int32
+ EnsureCapacity
+
+
+ arg
+ System.Int32
+
+
+
+ RusticiSoftware.System.Text.StringBuilderSupport
+
+ StringBuilderSupport.ensureCapacity(${this}, ${arg})
+
System.Text.StringBuilder
Insert
diff --git a/CS2JLibrary/src/RusticiSoftware/System/Text/StringBuilderSupport.java b/CS2JLibrary/src/RusticiSoftware/System/Text/StringBuilderSupport.java
new file mode 100644
index 0000000..bee6ae6
--- /dev/null
+++ b/CS2JLibrary/src/RusticiSoftware/System/Text/StringBuilderSupport.java
@@ -0,0 +1,24 @@
+package RusticiSoftware.System.Text;
+
+public class StringBuilderSupport {
+
+ // In C# ensureCapacity returns the new capacity
+ public static int ensureCapacity(StringBuilder sb, int capacity) {
+ sb.ensureCapacity(capacity);
+ return sb.capacity();
+ }
+ // In C# setLength pads with spaces
+ public static void setLength(StringBuilder sb, int newLen) {
+ if (sb.length() >= newLen) {
+ sb.setLength(newLen);
+ }
+ sb.append(String.format("%1$-" + (newLen - sb.length()) + "s", ""));
+ }
+
+ public static void main(String[] args) {
+ StringBuilder sb = new StringBuilder("hello");
+ System.out.println("**" + sb + "**");
+ StringBuilderSupport.setLength(sb,7);
+ System.out.println("**" + sb + "**");
+ }
+}