checking in working system
[IRC.git] / Robust / src / ClassLibrary / String.java
1 public class String {
2     char string[];
3
4     public String(char string[]) {
5         this.string=string;
6     }
7
8     public static String valueOf(Object o) {
9         return o.toString();
10     }
11
12     public static String valueOf(int x) {
13         int length=0;
14         int tmp;
15         if (x<0)
16             tmp=-x;
17         else
18             tmp=x;
19         do {
20             tmp=tmp/10;
21             length=length+1;
22         } while(tmp!=0);
23         
24         char chararray[];
25         if (x<0)
26             chararray=new char[length+1];
27         else
28             chararray=new char[length];
29         int offset;
30         if (x<0) {
31             chararray[0]='-';
32             offset=1;
33             x=-x;
34         } else
35             offset=0;
36         
37         do {
38             chararray[--length+offset]=(char)(x%10+'0');
39             x=x/10;
40         } while (length!=0);
41         return new String(chararray);
42     }
43 }