|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.redback.redbeans.RbString
Constructor Summary | |
RbString()
Construct a new RbString with no characters. |
|
RbString(java.lang.String sval)
Construct a new RbString object, setting
its initial value to that of the passed string. |
Method Summary | |
boolean |
alpha()
Function to determine if the string value for this instance of a RbString object represents
an 'alpha' string of characters. |
static boolean |
alpha(java.lang.String sval)
Function to determine if the passed string value is an 'alpha' string of characters. |
int |
col1()
Return the column position of the first character less one, of the substring returned by the most recent field method invoked for this object instance. |
int |
col2()
Return the column position of the last character plus one, of the substring returned by the most recent field method invoked for this object instance. |
void |
convert(java.lang.String oldStr,
java.lang.String newStr)
Convert 1 or more characters to other characters in the string value for this object instance. |
static java.lang.String |
convert(java.lang.String sval,
java.lang.String oldStr,
java.lang.String newStr)
Convert 1 or more characters to other characters in a string. |
int |
count(char pval)
Return the number of times 1 character appears in this instance of a RbString object. |
int |
count(java.lang.String pval)
Return the number of times 1 string appears in this instance of a RbString object. |
static int |
count(java.lang.String sval,
char pval)
Return the number of times 1 character appears in a specified string. |
static int |
count(java.lang.String sval,
java.lang.String pval)
Return the number of times 1 string appears in another specified string. |
protected static int |
countStr(java.lang.String sval,
java.lang.String pval,
boolean dcount)
Protected method used by the count method in this
class, and the dcount method of RbDynString
in this package. |
java.lang.String |
field(char dval,
int occur)
Return a substring of the string value for this instance of a RbString object, using a
specified delimiter character, and an occurrence
value for that delimiter. |
static java.lang.String |
field(java.lang.String sval,
char dval,
int occur)
Return a substring of the passed string value, using a specified delimiter character, and an occurrence value for that delimiter. |
java.lang.String |
field(java.lang.String dval,
int occur)
Return a substring of the string value for this instance of a RbString object, using a
specified delimiter string, and an occurrence
value for that delimiter. |
static java.lang.String |
field(java.lang.String sval,
java.lang.String dval,
int occur)
Return a substring of the passed string value, using a specified delimiter string, and an occurrence value for that delimiter. |
void |
fold(int length,
char delim)
Divide the string represented by this RbString
object into a number of substrings separated by a
specified delimiter character. |
static java.lang.String |
fold(java.lang.String sval,
int length,
char delim)
Fold is used to divide a string into a number of substrings separated by a specified delimiter character. |
int |
length()
Return the length of the string value of this RbString
in characters. |
boolean |
matches(java.lang.String pval)
Test the current string value of this RbString
object for a match on the specified pattern string. |
static boolean |
matches(java.lang.String sval,
java.lang.String pval)
Test a passed string for a match on a 'pattern' defined by a second string. |
boolean |
num()
Function to determine if the string value for this instance of a RbString object represents
a numeric value. |
static boolean |
num(java.lang.String sval)
Function to determine if the passed string value represents a numeric value. |
void |
string(java.lang.String sval)
Reset the RbString value to that of the passed string. |
void |
swap(java.lang.String oldStr,
java.lang.String newStr)
Swap (substitute) 1 string for another in a the current string value for this RbString object instance. |
static java.lang.String |
swap(java.lang.String sval,
java.lang.String oldStr,
java.lang.String newStr)
Swap (substitute) 1 string for another in a specified target string. |
java.lang.String |
toString()
Return the string value of this RbString object. |
void |
trim(char dval)
Function to 'trim' the string value for this instance of a RbString object. |
void |
trim(char dval,
char mode)
Function to 'trim' the string value for this instance of a RbString object. |
static java.lang.String |
trim(java.lang.String sval,
char dval)
Function to 'trim' the passed string value. |
static java.lang.String |
trim(java.lang.String sval,
char dval,
char mode)
Function to 'trim' the passed string value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public RbString()
RbString
with no characters.public RbString(java.lang.String sval)
RbString
object, setting
its initial value to that of the passed string.sval
- a String
Method Detail |
public java.lang.String toString()
RbString
object.toString
in class java.lang.Object
String
public int length()
RbString
in characters.int
- Number of chars in string.public void string(java.lang.String sval)
RbString
value to that of the passed string.sval
- a String
public int count(java.lang.String pval)
RbString
object. Provides functionality
similar to the COUNT() function.pval
- a String
that represents the value
to be counted.int
that represents how many times
pval was found in the string for this object.public int count(char pval)
RbString
object. Provides
functionality similar to the COUNT() function.pval
- a char
that represents the single
character value to be counted.int
that represents how many times
pval was found in the string for this object.public static int count(java.lang.String sval, java.lang.String pval)
sval
- a String
that represents the
string in which occurrences of another string are
to be counted.pval
- a String
that represents the value
to be counted.int
that represents how many times
pval was found in the string sval.public static int count(java.lang.String sval, char pval)
sval
- a String
that represents the
string in which occurrences of another string are
to be counted.pval
- a char
that represents the
character value to be counted.int
that represents how many times
pval was found in the string sval.protected static int countStr(java.lang.String sval, java.lang.String pval, boolean dcount)
count
method in this
class, and the dcount
method of RbDynString
in this package. This logic does the actual counting of values
within a string.sval
- a String
that represents the
string in which values are to be counted.pval
- a String
that represents the
value to count.dcount
- a boolean
flag to determines if the
count action is to emulate a DOCUNT() (flag
set 'true') or COUNT() (flag set false) function.int
that represents result of the
count operation.public void swap(java.lang.String oldStr, java.lang.String newStr)
RbString
object instance.oldStr
- a String
- represents the
string that is to be swapped out. Ie: The 'old'
value.newStr
- a String
- represents the
string that will replace oldStr in the target
value. Ie: The 'new' string.public static java.lang.String swap(java.lang.String sval, java.lang.String oldStr, java.lang.String newStr)
sval
- a String
that represents the
target string for the swap operation.oldStr
- a String
- represents the
string that is to be swapped out. Ie: The 'old'
value.newStr
- a String
- represents the
string that will replace oldStr in the target
value. Ie: The 'new' string.String
that represents the target
string after the swap operation.public boolean matches(java.lang.String pval)
RbString
object for a match on the specified pattern string. Provides
functionality similar to the MATCHES operator.pval
- a String
that defines the 'pattern'
that is to be used to 'match' the current string value
of this RbString
. This pattern string
can be made up of a number of elements. These are:
nN - 'n' numeric digits, 0 indicates any number of numeric digits will be accepted. eg: 3N = 3 numeric digits are expected. nA - similar to above, but the test is on alpha chars. ie: A-Z and a-z nX - 'n' number of _any_ characters. # - 'wildcard' - same as '1A' 'xxx' or "xxx" - match on literal text in quotes. other - expect exact match (like above)
boolean
flag. True if match successful.public static boolean matches(java.lang.String sval, java.lang.String pval)
sval
- a String
that represents the
target string for the match operation.pval
- a String
that defines the 'pattern'
that is to be used to 'match' the current string value
of this RbString
. This pattern string
can be made up of a number of elements. These are:
nN - 'n' numeric digits, 0 indicates any number of numeric digits will be accepted. eg: 3N = 3 numeric digits are expected. nA - similar to above, but the test is on alpha chars. ie: A-Z and a-z nX - 'n' number of _any_ characters. # - 'wildcard' - same as '1A' 'xxx' or "xxx" - match on literal text in quotes. other - expect exact match (like above)
boolean
flag. True if match successful.public void convert(java.lang.String oldStr, java.lang.String newStr)
oldStr
- a String
- represents the
character (or characters) to be replaced in
the sval string.newStr
- a String
- represents the
character(s) that will replace the corresponding
characters in oldStr in string sval.public static java.lang.String convert(java.lang.String sval, java.lang.String oldStr, java.lang.String newStr)
sval
- a String
that represents the
target string for the swap operation.oldStr
- a String
- represents the
character (or characters) to be replaced in
the sval string.newStr
- a String
- represents the
character(s) that will replace the corresponding
characters in oldStr in string sval.String
that represents the target
string after the replacement operation.public boolean num()
RbString
object represents
a numeric value.boolean
value set to true
if the string is numeric, or false
if it
is not.public static boolean num(java.lang.String sval)
boolean
value set to true
if the string is numeric, or false
if it
is not.public boolean alpha()
RbString
object represents
an 'alpha' string of characters. This is only true if
all characters fall in the range 'A - Z' or 'a - z'.boolean
value set to true
if the string is alphabetic, or false
if it
is not.public static boolean alpha(java.lang.String sval)
boolean
value set to true
if the string is alphabetic, or false
if it
is not.public void trim(char dval)
RbString
object. The string value will be
stripped of leading, trailing and extraneous occurrences
of the specified character. Extraneous occurrences are
deemed to be repetitions of that character. This will be
replaced will a single occurrence of that character.
For example:
RbString foo = new RbString("@this@@is@@@text@@"); foo.trim('@');will set the string value for object foo to be:
'this@is@text'
dval
- a char
value that represents the
character to be 'trimmed' from the object string.public void trim(char dval, char mode)
RbString
object. The string value will be
trimmed according to a defined mode value.dval
- a char
value that represents the
character to be 'trimmed' from the object string.mode
- a A - remove ALL occurrences of dval from string. L - strip leading occurrences of dval T - strip trailing occurrences of dval R - remove leading, trailing and extraneous occurrences of dval. Extraneous occurrences are deemed to be repetitions of dval.
public static java.lang.String trim(java.lang.String sval, char dval)
String foo = RbString.trim("@this@@is@@@text@@", '@');will set the string value for object foo to be:
'this@is@text'
sval
- a String
value that represents
the target string for the trim operation.dval
- a char
value that represents the
character to be 'trimmed' from the string.String
that is the result of the
trim operation.public static java.lang.String trim(java.lang.String sval, char dval, char mode)
sval
- a String
value that represents
the target string for the trim operation.dval
- a char
value that represents the
character to be 'trimmed' from the string.mode
- a A - remove ALL occurrences of dval from string. L - strip leading occurrences of dval T - strip trailing occurrences of dval R - remove leading, trailing and extraneous occurrences of dval. Extraneous occurrences are deemed to be repetitions of dval.
String
that is the result of the
trim operation.public static java.lang.String field(java.lang.String sval, char dval, int occur)
x = RbString.field("xxx.yyy.zzz", '.', 2) x now contains "yyy"
sval
- a String
that represents the
string value to return a substring from.dval
- a char
the delimiter character.occur
- an int
specifies the occurrence
of the substring to be returned. For example: if
set to 3, then substring delimited by the second
and third occurrence of the delimiter character
will be returned.String
that represents the substring
extracted from sval.public static java.lang.String field(java.lang.String sval, java.lang.String dval, int occur)
x = RbString.field("xxxQQyyyQQzzz", "QQ", 2) x now contains "yyy"
sval
- a String
that represents the
string value to return a substring from.dval
- a String
- the delimiter.occur
- an int
specifies the occurrence
of the substring to be returned. For example: if
set to 3, then substring delimited by the second
and third occurrence of the delimiter character
will be returned.String
that represents the substring
extracted from sval.public java.lang.String field(char dval, int occur)
RbString
object, using a
specified delimiter character, and an occurrence
value for that delimiter. Provides functionality that
emulates the FIELD function. For example:
x = RbString.field("xxx.yyy.zzz", '.', 2) x now contains "yyy"This method also sets 2 object instance variables for subsequent interrogation. These may be accessed by the col1() and col2() methods, and represent:
col1() - returns anint
that defines the start position less 1 of the substring. col2() - returns anint
that defines the end position plus 1 of the substring.
dval
- a char
the delimiter character.occur
- an int
specifies the occurrence
of the substring to be returned. For example: if
set to 3, then substring delimited by the second
and third occurrence of the delimiter character
will be returned.String
that represents the substring
extracted from sval.public java.lang.String field(java.lang.String dval, int occur)
RbString
object, using a
specified delimiter string, and an occurrence
value for that delimiter. Provides functionality that
emulates the FIELD function. For example:
x = RbString.field("xxxQQyyyQQzzz", "QQ", 2) x now contains "yyy"This method also sets 2 object instance variables for subsequent interrogation. These may be accessed by the col1() and col2() methods, and represent:
col1() - returns anint
that defines the start position less 1 of the substring. col2() - returns anint
that defines the end position plus 1 of the substring.
dval
- a String
- the delimiter.occur
- an int
specifies the occurrence
of the substring to be returned. For example: if
set to 3, then substring delimited by the second
and third occurrence of the delimiter character
will be returned.String
that represents the substring
extracted from sval.public int col1()
int
the start less one, of the
substring returned by the last field method.public int col2()
int
the end, plus one, of the
substring returned by the last field method.
If this method returns -1, then the most recent
field method returned a null string.public void fold(int length, char delim)
RbString
object into a number of substrings separated by a
specified delimiter character. The string is separated
into substrings of a length less than or equal to a
specified length value. The string is separated on
blanks if possible, otherwise into substrings of the
specified length. Note that if separated on a space
character, the space will be replaced by the delimiter.length
- a int
that represents the maximum
character length of each substring.delim
- a char
that represents the delimiter
character to insert between substrings.public static java.lang.String fold(java.lang.String sval, int length, char delim)
sval
- a String
that represents the string
on which the fold operation will be performed.length
- a int
that represents the maximum
character length of each substring.delim
- a char
that represents the delimiter
character to insert between substrings.String
that represents the 'folded'
string result.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |