John W. Campbell
This class stores an array of strings to be searched for a match for a given
string. All strings will be trimmed (start & end) prior to comparisons though
a blank string is allowed. The comparisons may be case sensitive or case
insensitive.
Class, constructor and methods:
Class Details
Accessible Fields
Constructor
Methods
- Package:
- Jdl.JdlLib;
- Class name:
- JdlStringList
- Class definition:
- public class JdlStringList
- Extends:
- Object
- Implements:
- none
- Actions:
- none
No fields with public, package or protected access defined.
A single constructor is available.
Constructor:
Standard constructor
Constructs a JdlStringList with a set of strings. By default, case will be
ignored in string comparisons.
- Constructor Definition:
- public JdlStringList (String[] strs)
- Parameters List:
- strs
- An array of strings.
This section contains methods for finding strings in the list and
setting the requirement for case handling in comparisons.
Methods:
Is string in list - isInList
Is string in list - isAbbreviatedInList
Index in list - indexInList
Index in list - indexAbbreviatedInList
Set case option - setIgnoreCase
Number of strings - numberOfStrings
String at index - stringAtIndex
Test whether a given string is in the stored list of strings.
- Method Definition:
- public boolean isInList (String str)
- Parameters List:
- str
- The string to be looked for.
- Method Return:
-
= true string found; = false string not found.
Test whether a given string is in the stored list of strings. An abbreviated
string may be given if it is unambiguous.
- Method Definition:
- public boolean isAbbreviatedInList (String str)
- Parameters List:
- str
- The string (possibly abbreviated) to be looked for.
- Method Return:
-
= true string found; = false string not found or ambiguous.
Returns the index of a given string in the stored strings list if
it is present.
- Method Definition:
- public int indexInList (String str)
- Parameters List:
- str
- The string to be looked for.
- Method Return:
-
The index of the string within the list; -1 if not found.
Returns the index of a given string in the stored strings list if
it is present. An abbreviated string may be given if it is unambiguous.
- Method Definition:
- public int indexAbbreviatedInList (String str)
- Parameters List:
- str
- The string (possibly abbreviated) to be looked for.
- Method Return:
-
The index of the string within the list; -1 if not found; -2 ambiguous
match.
This method sets the value of the 'ignore case' flag for use in string
comparisons.
- Method Definition:
- public void setIgnoreCase (boolean flg)
- Parameters List:
- flg
- =true ignore case (the object's default); = false case sensitive.
Returns the number of strings in the list.
- Method Definition:
- public int numberOfStrings()
- Parameters List:
- none
- Method Return:
-
The number of strings.
Returns the string at a given index in the list.
- Method Definition:
- public String stringAtIndex(int idx)
- Parameters List:
- indx
- The index in the strings list of the requested string.
- Method Return:
-
The returned string (null if out of range).
⇑ Up 2
⇑ Up 1
⇑ Top of this