public class Utility
extends java.lang.Object
Copyright (C) Damian Ryan Eads, 2001. All Rights Reserved. ritopt is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. ritopt is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with ritopt; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Constructor and Description |
---|
Utility() |
Modifier and Type | Method and Description |
---|---|
static boolean |
contains(char check,
java.lang.String list)
Returns true if any of the characters in the list are equal to
the check character.
|
static boolean |
contains(java.lang.String check,
java.lang.String list)
Returns true if any of the characters in the list appear in the
check string passed.
|
static int |
count(java.lang.String check,
char spec)
Returns the number of occurances the character specification
appears in the check string passed.
|
static java.lang.String |
expandString(java.lang.String s,
int length)
Returns a string with no more and no less than n characters
where n is the length.
|
static java.lang.String |
getSpaces(int count)
Returns a string containing the number of spaces passed as an
argument.
|
static boolean |
isAlpha(char check)
Returns true if the character is a letter in the phonetic alphabetic.
|
static boolean |
isAlpha(java.lang.String check)
Returns true if the string only contains letters in the phonetic
alphabet.
|
static boolean |
isAlphaLower(char check)
Returns true if the character is a lower case letter in the
phonetic alphabetic.
|
static boolean |
isAlphaLower(java.lang.String check)
Returns true if the string only contains lower case letters in the
phonetic alphabet.
|
static boolean |
isAlphaNumeric(char check)
Returns true if the character is a letter in the phonetic alphabetic
or is a decimal number.
|
static boolean |
isAlphaUpper(char check)
Returns true if the character is a upper case letter in the
phonetic alphabetic.
|
static boolean |
isAlphaUpper(java.lang.String check)
Returns true if the string only contains upper case letters in the
phonetic alphabet.
|
static boolean |
isNumeric(char check)
Returns true if the character is a decimal number.
|
static java.lang.String |
ltrim(java.lang.String s)
Trim spaces off the left side of this string.
|
static java.lang.String |
repeat(char c,
int count)
Returns a string with a character repeated based on a count passed.
|
static java.lang.String |
repeat(java.lang.String s,
int count)
Returns a string with the passed string repeated based on the
integer count passed.
|
static java.lang.String |
rtrim(java.lang.String s)
Trim spaces off the right side of this string.
|
static java.lang.String |
stripComments(java.lang.String s,
char delim,
char comment)
Takes a line (presumably from a file) and removes a comment if
one exists.
|
static java.lang.String |
trim(java.lang.String s)
Trim spaces off both sides of this string.
|
public static boolean contains(java.lang.String check, java.lang.String list)
check
- The string to check.list
- The list of valid characters.public static int count(java.lang.String check, char spec)
check
- The string to check.spec
- The character specification.public static boolean contains(char check, java.lang.String list)
check
- The character to check.list
- The list of valid characters.public static boolean isAlpha(java.lang.String check)
check
- The string to check.public static boolean isAlphaLower(java.lang.String check)
check
- The string to check.public static boolean isAlphaUpper(java.lang.String check)
check
- The string to check.public static boolean isAlpha(char check)
check
- The character to check.public static boolean isAlphaLower(char check)
check
- The character to check.public static boolean isAlphaUpper(char check)
check
- The character to check.public static boolean isAlphaNumeric(char check)
check
- The character to check.public static boolean isNumeric(char check)
check
- The character to check.public static java.lang.String expandString(java.lang.String s, int length)
s
- The string to expand.length
- The required length.public static java.lang.String getSpaces(int count)
count
- The number of spaces in the string returned.public static java.lang.String repeat(char c, int count)
c
- The character to repeat.count
- The number of times to repeat the character.public static java.lang.String ltrim(java.lang.String s)
s
- The string to trim.public static java.lang.String rtrim(java.lang.String s)
s
- The string to trim.public static java.lang.String trim(java.lang.String s)
s
- The string to trim.public static java.lang.String stripComments(java.lang.String s, char delim, char comment)
s
- The string to strip comments off.delim
- The string delimiter.comment
- The comment character.public static java.lang.String repeat(java.lang.String s, int count)
s
- The string to repeat.count
- The number of times to repeat the string.