This update:
[IRC.git] / Robust / src / ClassLibrary / String.java
index 689d3cf9f2c28df5bfd1d5ebb2a6b1153eaf025b..4d4dfc507fc30dfab8611fa00d267420d770d1bb 100644 (file)
@@ -15,7 +15,7 @@ public class String {
        this.count=str.length;
        this.offset=0;
     }
-
+    
     public String(byte str[]) {
        char charstr[]=new char[str.length];
        for(int i=0;i<str.length;i++)
@@ -58,6 +58,21 @@ public class String {
        return this.lastindexOf(ch, count - 1);
     }
 
+    public String concat(String str) {
+       String newstr=new String();
+       newstr.count=this.count+str.count;
+       char charstr[]=new char[newstr.count];
+       newstr.value=charstr;
+       newstr.offset=0;
+       for(int i=0;i<count;i++) {
+           charstr[i]=value[i+offset];
+       }
+       for(int i=0;i<str.count;i++) {
+           charstr[i+count]=str.value[i+str.offset];
+       }
+       return newstr;
+    }
+
     public int lastindexOf(int ch, int fromIndex) {
        for(int i=fromIndex;i>0;i--)
            if (this.charAt(i)==ch)
@@ -141,7 +156,10 @@ public class String {
     }
 
     public static String valueOf(Object o) {
-       return o.toString();
+       if (o==null)
+           return "null";
+       else
+           return o.toString();
     }
 
     public static String valueOf(int x) {