+ public int lastindexOf(int ch) {
+ return this.lastindexOf(ch, count - 1);
+ }
+
+ public static String concat2(String s1, String s2) {
+ if (s1==null)
+ return "null".concat(s2);
+ else
+ return s1.concat(s2);
+ }
+
+ 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)
+ return i;
+ return -1;
+ }
+
+ public String replace(char oldch, char newch) {
+ char[] buffer=new char[count];
+ for(int i=0;i<count;i++) {
+ char x=charAt(i);
+ if (x==oldch)
+ x=newch;
+ buffer[i]=x;
+ }
+ return new String(buffer);
+ }
+
+ public String toUpperCase() {
+ char[] buffer=new char[count];
+ for(int i=0;i<count;i++) {
+ char x=charAt(i);
+ if (x>='a'&&x<='z') {
+ x=(char) ((x-'a')+'A');
+ }
+ buffer[i]=x;
+ }
+ return new String(buffer);
+ }
+