X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=Robust%2Fsrc%2FClassLibrary%2FString.java;fp=Robust%2Fsrc%2FClassLibrary%2FString.java;h=0000000000000000000000000000000000000000;hb=refs%2Ftags%2Fbuildscript;hp=f1ec9d53c2cc76fd5f17c3cab0a3ae6b8fcc0c30;hpb=b9df1caacff3dbe5959bc12e0e6ba46500fcd3e2;p=IRC.git diff --git a/Robust/src/ClassLibrary/String.java b/Robust/src/ClassLibrary/String.java deleted file mode 100644 index f1ec9d53..00000000 --- a/Robust/src/ClassLibrary/String.java +++ /dev/null @@ -1,343 +0,0 @@ -public class String { - char value[]; - int count; - int offset; - private int cachedHashcode; - - private String() { - } - - public String(char str[]) { - char charstr[]=new char[str.length]; - for(int i=0;i(str.length-offset)) - length=str.length-offset; - char charstr[]=new char[length]; - for(int i=0;ithis.count||endIndex>this.count||beginIndex>endIndex) { - // FIXME - System.printString("Index error: "+beginIndex+" "+endIndex+" "+count+"\n"+this); - } - str.value=this.value; - str.count=endIndex-beginIndex; - str.offset=this.offset+beginIndex; - return str; - } - - public String subString(int beginIndex) { - return this.subString(beginIndex, this.count); - } - - 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;i0;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='a'&&x<='z') { - x=(char) ((x-'a')+'A'); - } - buffer[i]=x; - } - return new String(buffer); - } - - public int indexOf(int ch) { - return this.indexOf(ch, 0); - } - - public int indexOf(int ch, int fromIndex) { - for(int i=fromIndex;ifromIndex) - k=fromIndex; - for(;k>=0;k--) { - if (regionMatches(k, str, 0, str.count)) - return k; - } - return -1; - } - - public int lastIndexOf(String str) { - return lastIndexOf(str, count-str.count); - } - - public boolean startsWith(String str) { - return regionMatches(0, str, 0, str.count); - } - - public boolean startsWith(String str, int toffset) { - return regionMatches(toffset, str, 0, str.count); - } - - public boolean regionMatches(int toffset, String other, int ooffset, int len) { - if (toffset<0 || ooffset <0 || (toffset+len)>count || (ooffset+len)>other.count) - return false; - for(int i=0;i='a'&&l<='z') - l=(char)((l-'a')+'A'); - if (r>='a'&&r<='z') - r=(char)((r-'a')+'A'); - if (l!=r) - return false; - } - return true; - } -}