|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcds.util.Strings
Utility methods for String algorithm
Field Summary | |
static int |
CENTER
|
static int |
JUSTIFY
|
static int |
LEFT
|
static int |
RIGHT
|
Constructor Summary | |
Strings()
|
Method Summary | |
static java.lang.String |
bracketsToParentheses(java.lang.String str)
Remplacement des crochets par des parentheses dans une chaine de caracteres |
static PairInteger |
delimit(java.lang.String str,
int idx)
Returns a pair of positions in a string which delimit a quoted string. |
static java.lang.String |
duplicate(char c,
int n)
Build a string by duplicating a character x times |
static java.lang.String |
escape(java.lang.String str,
char quote)
Escape all special characters in a string for storage and further re-analysis with delimit() and reduce() |
static boolean |
isTypeOf(java.lang.String str,
java.lang.String type)
Test du type d'une chaine de caracteres (numerique, alphanumerique...) |
static boolean |
isUpperString(java.lang.String string,
java.lang.String ignorechars)
MOD-BB ajout de cette methode; Renvoie vrai si la chaine passee en parametre est en majuscule, faux sinon. |
static java.lang.String |
justify(int dir,
int integer,
int npos,
char fill)
Returns a string representing an integer number jsutified like specified |
static java.lang.String |
justify(int dir,
java.lang.String str,
int npos,
char fill)
Returns a string on 'n' character LEFT or RIGHT justified, and filled with a specified character |
static void |
main(java.lang.String[] args)
|
static java.lang.String |
reduce(java.lang.String str)
Reduces a String by management of quotes, substitution of \x chars, ... |
static java.lang.String |
reduce(java.lang.String str,
int begin,
int end)
Reduces a String by management of quotes, substitution of \x chars, ... |
static java.lang.String |
reduce(java.lang.String str,
PairInteger pi)
Reduces a String by management of quotes, substitution of \x chars, ... |
static java.lang.String |
simpleQuote(java.lang.String str)
Traitement de l'apostrophe dans la chaine de caracteres Toutes les occurences de ' sont remplacees par \' |
static java.lang.String |
splitText(java.lang.String text,
int linesize,
int format)
Split a long text in lines having a maximum size. |
static java.lang.String |
trimchar(java.lang.String str,
char c)
Suppresses beginning, ending and all redundant occurence of a specified character in a string |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int LEFT
public static final int RIGHT
public static final int CENTER
public static final int JUSTIFY
Constructor Detail |
public Strings()
Method Detail |
public static java.lang.String trimchar(java.lang.String str, char c)
str
- string to clean upc
- char to eliminate
public static PairInteger delimit(java.lang.String str, int idx)
str
- String in which a quoted string is to findidx
- begin index to search for the "string"
public static java.lang.String reduce(java.lang.String str, PairInteger pi)
str
- String in which the 'string' to reduce is containedpi
- PairInteger object containing the position of the opening quote
and the position of the char after the closing quote
public static java.lang.String reduce(java.lang.String str, int begin, int end)
str
- String in which the 'string' to reduce is contained.
If the string doesn't begin with a quote, no internal quote management
will be performed.begin
- first char of the 'string' (first char, or opening quote if
the string is surrounded by quotes)end
- first char after the string (after the last char or the
closing quote if it exists)
public static java.lang.String reduce(java.lang.String str)
str
- String to reduce
public static java.lang.String escape(java.lang.String str, char quote)
str
- String to escapequote
- designates the surrounding quote type (single or double).
'\0' if none. The same character will be doubled in the string
public static java.lang.String simpleQuote(java.lang.String str)
str
- the String to transform
public static java.lang.String bracketsToParentheses(java.lang.String str)
str
- chaine a traiter
public static java.lang.String justify(int dir, int integer, int npos, char fill)
dir
- direction of justification (Strings.LEFT, .RIGHT or .CENTER)integer
- the number to convert into a stringnpos
- number of positionsfill
- fill character
public static java.lang.String justify(int dir, java.lang.String str, int npos, char fill)
dir
- direction of justification (Strings.LEFT, .RIGHT or .CENTER)str
- the string to justifynpos
- the total number of positions. If the specified number of positions
is not suffisant, the string is returned identical.fill
- the fill character
public static java.lang.String splitText(java.lang.String text, int linesize, int format)
text
- original text to formatlinesize
- maximum size of each lineformat
- Strings.LEFT, Strings.RIGHT, Strings.CENTERED or Strings.JUSTIFY
public static java.lang.String duplicate(char c, int n)
c
- char to duplicaten
- number of times
public static boolean isTypeOf(java.lang.String str, java.lang.String type)
str
- chaine a testertype
- type a tester
public static boolean isUpperString(java.lang.String string, java.lang.String ignorechars)
string
- Chaine que l'on veut tester.
public static void main(java.lang.String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |