2.3.3 - String List - JdlStringList

John W. Campbell

2.3.3.1 Introduction

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

2.3.3.2 Class Details

Package:
Jdl.JdlLib;
Class name:
JdlStringList
Class definition:
public class JdlStringList
Extends:
Object
Implements:
none
Actions:
none

2.3.3.3 Accessible Fields

No fields with public, package or protected access defined.

2.3.3.4 Constructor

2.3.3.4.1 Introduction

A single constructor is available.

Constructor:

Standard constructor

2.3.3.4.2 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.

2.3.3.5 Methods

2.3.3.5.1 Introduction

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

2.3.3.5.2 Is string in list - isInList

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.

2.3.3.5.3 Is string in list - isAbbreviatedInList

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.

2.3.3.5.4 Index in list - indexInList

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.

2.3.3.5.5 Index in list - indexAbbreviatedInList

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.

2.3.3.5.6 Set case option - setIgnoreCase

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.

2.3.3.5.7 Number of strings - numberOfStrings

Returns the number of strings in the list.

Method Definition:
public int numberOfStrings()
Parameters List:
none
Method Return:
The number of strings.

2.3.3.5.8 String at index - stringAtIndex

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