9 public String(char str[]) {
10 char charstr[]=new char[str.length];
11 for(int i=0;i<str.length;i++)
14 this.count=str.length;
18 public String(byte str[]) {
19 char charstr[]=new char[str.length];
20 for(int i=0;i<str.length;i++)
21 charstr[i]=(char)str[i];
23 this.count=str.length;
27 public String(String str) {
30 this.offset=str.offset;
33 public String(StringBuffer strbuf) {
34 value=new char[strbuf.length()];
35 count=strbuf.length();
37 for(int i=0;i<count;i++)
38 value[i]=strbuf.value[i];
41 public String subString(int beginIndex, int endIndex) {
42 String str=new String();
43 if (beginIndex>this.count||endIndex>this.count||beginIndex>endIndex) {
47 str.count=endIndex-beginIndex;
48 str.offset=this.offset+beginIndex;
52 public String subString(int beginIndex) {
53 return this.subString(beginIndex, this.count);
56 public int indexOf(int ch) {
57 return this.indexOf(ch, 0);
60 public int indexOf(int ch, int fromIndex) {
61 for(int i=fromIndex;i<count;i++)
62 if (this.charAt(i)==ch)
67 public int indexOf(String str) {
68 return this.indexOf(str, 0);
71 public int indexOf(String str, int fromIndex) {
74 for(int i=fromIndex;i<=(count-str.count);i++)
75 if (regionMatches(i, str, 0, str.count))
80 public boolean regionMatches(int toffset, String other, int ooffset, int len) {
81 if (toffset<0 || ooffset <0 || (toffset+len)>count || (ooffset+len)>other.count)
83 for(int i=0;i<len;i++)
84 if (other.value[i+other.offset+ooffset]!=
85 this.value[i+this.offset+toffset])
90 public char[] toCharArray() {
91 char str[]=new char[count];
92 for(int i=0;i<count;i++)
93 str[i]=value[i+offset];
97 public byte[] getBytes() {
98 byte str[]=new byte[count];
99 for(int i=0;i<value.length;i++)
100 str[i]=(byte)value[i+offset];
104 public int length() {
108 public char charAt(int i) {
109 return value[i+offset];
112 public String toString() {
116 public static String valueOf(Object o) {
120 public static String valueOf(int x) {
134 chararray=new char[length+1];
136 chararray=new char[length];
146 chararray[--length+voffset]=(char)(x%10+'0');
149 return new String(chararray);