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 startsWith(String str) {
81 return regionMatches(0, str, 0, str.count);
84 public boolean regionMatches(int toffset, String other, int ooffset, int len) {
85 if (toffset<0 || ooffset <0 || (toffset+len)>count || (ooffset+len)>other.count)
87 for(int i=0;i<len;i++)
88 if (other.value[i+other.offset+ooffset]!=
89 this.value[i+this.offset+toffset])
94 public char[] toCharArray() {
95 char str[]=new char[count];
96 for(int i=0;i<count;i++)
97 str[i]=value[i+offset];
101 public byte[] getBytes() {
102 byte str[]=new byte[count];
103 for(int i=0;i<count;i++)
104 str[i]=(byte)value[i+offset];
108 public int length() {
112 public char charAt(int i) {
113 return value[i+offset];
116 public String toString() {
120 public static String valueOf(Object o) {
124 public static String valueOf(int x) {
138 chararray=new char[length+1];
140 chararray=new char[length];
150 chararray[--length+voffset]=(char)(x%10+'0');
153 return new String(chararray);