The StringList class of delphi is really easy to use. I tried to write
Package com. zhao_yi.sysutils.classes;
Import java. util. List;
Import java. util. ArrayList;
Import java. util. StringTokenizer;
Import com. zhao_yi.sysutils.SysUtil;
Import com. zhao_yi.sysutils .*;
Import java. util. Arrays;
Import java. util .*;
Public class StringList {
Private List strings = new ArrayList ();
Private List objects = new ArrayList ();
Private boolean sorted = false;
Public StringList (){
}
Public String [] getStrings (){
Return (String []) strings. toArray (new String [strings. size ()]);
}
Public void setStrings (String [] array ){
Strings = null; objects = null;
Strings = new ArrayList (Arrays. asList (array ));
Objects = new ArrayList (array. length );
}
Private void rangeCheck (int Index) throws IndexOutOfBoundsException {
If (Index <0) | (Index> = getCount ()))
Throw new IndexOutOfBoundsException ();
}
Public int getCount (){
Return strings. size ();
}
Public String Get (int Index ){
Return (String) strings. get (Index );
}
Public int Find (String S ){
Int I, L, H, C;
L = 0;
H = getCount ()-1;
While (L <= H ){
I = (L + H)/2;
C = SysUtil. CompareStrings (Get (I), S );
If (C <0)
L = I + 1;
Else {
H = I-1;
If (C = 0)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service