|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.vishia.util.StringPart
public class StringPart
The StringPart class represents a flexible valid part of a character string which spread is changeable.
This is a enhancement of the standard class String or StringBuffer.
The StringPart class is associated to a String. Additionaly 4 Parameters determine the actual part of the String
and the limits of changing this actual part. The followed image is used to explain the spreadness of the parts:
abcdefghijklmnopqrstuvwxyz Sample of the whole associated String
===================== The === indicates the maximal part
----------- The --- indicates the valid part before some operation
+++++ The +++ indicates the valid part after some operation
At a first idea a part is likely a substring.
But the actual part of the string is changeable, without building a new substring.
So some operations of seeking and scanning
are supported. The collectivity methods to scan strings from a file (Reader) are supported from a derivated
class StringScan of this class.scanOk, see there.
| Field Summary | |
|---|---|
protected boolean |
bCurrentOk
false if current scanning is not match |
(package private) boolean |
bFound
True if the last operation of lento__(), seek etc. has found anything. |
protected int |
bitMode
Some mode bits |
protected boolean |
bStartScan
If true, than all idxLastScanned... are set to 0, it is after scanOk() or after scanStart() |
static char |
cEndOfText
The char used to code end of text. |
(package private) java.lang.String |
content
The referenced string |
static char |
cStartOfText
The char used to code start of text. |
protected int |
end
The actual exclusive end position of the valid part. |
protected int |
endLast
Borders of the last part before calling of scan__(), seek__(), lento__(). |
protected int |
endMax
The rightest possible exclusive end position. |
private int |
idxLastFloatNumber
current index of the last scanned float number. -1=nothing scanned. 0..4=valid |
private int |
idxLastIntegerNumber
current index of the last scanned integer number. -1=nothing scanned. 0..4=valid |
private static int |
mSeekBackward_
Flag bit to force seeking backward. |
private static int |
mSeekToLeft_
Flag bit to force seeking left from start (Backward). |
protected static int |
mSkipOverCommentInsideText_mode
Bit in mode. |
protected static int |
mSkipOverCommentToEol_mode
Bit in mode. |
protected static int |
mSkipOverWhitespace_mode
Bit in mode. |
protected double[] |
nLastFloatNumber
Last scanned float number |
protected long[] |
nLastIntegerNumber
Last scanned integer number. |
protected int |
nLineCt
The line number, counted by founded \n |
(package private) java.lang.String |
sCommentEnd
The string defined the end of comment inside a text. |
(package private) java.lang.String |
sCommentStart
The string defined the start of comment inside a text. |
(package private) java.lang.String |
sCommentToEol
The string defined the start of comment to end of line |
static int |
seekBack
Flag to force seeking backward from the end position. |
static int |
seekEnd
Flag to force setting the start position after the seeking string. |
static int |
seekNormal
Flag to force seeking forward. |
static int |
seekToLeft
Flag to force seeking backward from the start position. |
protected java.lang.String |
sLastString
Last scanned string. |
protected int |
start
The actual start position of the valid part. |
protected int |
startLast
Borders of the last part before calling of scan__(), seek__(), lento__(). |
protected int |
startMin
The leftest possible start position. |
protected int |
startScan
Position of scanStart() or after scanOk() as start of next scan operations. |
| Constructor Summary | |
|---|---|
StringPart()
Creates a new empty StringPart without an associated String. |
|
StringPart(java.lang.String content)
Creates a new StringPart, with the given content from a String. |
|
StringPart(StringPart src)
Creates a new StringPart with the same String as the given StringPart. |
|
| Method Summary | |
|---|---|
StringPart |
assign(java.lang.String content)
Sets the content to the given string, forgets the old content. |
StringPart |
assign(StringPart src)
Sets the StringPart with the same String object as the given StringPart, forgets the old content. |
StringPart |
assignFromEnd(StringPart src)
Sets the content of the StringPart , forgets the old content. |
java.lang.String |
debugString()
Returns a debug information of the content of the StringPart. |
boolean |
equals(java.lang.String sCmp)
Compares the Part of string with the given string |
boolean |
found()
Returns true, if the last called seek__(), lento__() or skipWhitespaceAndComment() operation founds the requested condition. |
StringPart |
fromEnd()
Sets the start of the part to the exclusively end, set the end to the end of the content. |
private java.lang.String |
getCircumScriptionToAnyChar_p(java.lang.String sCharsEnd,
boolean bOutsideQuotion)
|
java.lang.String |
getCircumScriptionToAnyChar(java.lang.String sCharsEnd)
Gets a String with translitaration. |
java.lang.String |
getCircumScriptionToAnyCharOutsideQuotion(java.lang.String sCharsEnd)
|
java.lang.String |
getCurrent(int nChars)
Gets the next chars from current Position. |
char |
getCurrentChar()
Gets the next char at current Position. |
int |
getCurrentColumn()
Gets the current position in line (column of the text). |
java.lang.String |
getCurrentPart()
Returns the actual part of the string. |
java.lang.String |
getCurrentPart(int maxLength)
Returns the actual part of the string. |
long |
getCurrentPosition()
Gets the current position, useable for rewind. |
java.lang.String |
getLastPart()
Returns the last part of the string before any seek or scan operation. |
double |
getLastScannedFloatNumber()
Returns the last scanned float number. |
long |
getLastScannedIntegerNumber()
Returns the last scanned integer number. |
java.lang.String |
getLastScannedString()
|
int |
getLen()
Deprecated. |
int |
getLineCt()
get the Line ct |
int |
indexEndOfQuotion(char cEndQuotion,
int fromWhere,
int maxToTest)
Searches the end of a quotion string. |
int |
indexOf(char ch)
Returns the position of the char within the part, returns -1 if the char is not found in the part. |
int |
indexOf(char ch,
int fromIndex)
Returns the position of the char within the part, started inside the part with fromIndex, returns -1 if the char is not found in the part started from 'fromIndex'. |
int |
indexOf(java.lang.String sCmp)
Returns the position of the string within the part. |
int |
indexOf(java.lang.String sCmp,
int fromIndex,
int maxToTest)
Returns the position of the string within the part. |
int |
indexOfAnyChar(java.lang.String sChars)
Returns the position of one of the chars in sChars within the part, returns -1 if the char is not found in the actual part. |
int |
indexOfAnyChar(java.lang.String sChars,
int fromWhere,
int maxToTest)
Returns the position of one of the chars in sChars within the part, started inside the part with fromIndex, returns -1 if the char is not found in the part started from 'fromIndex'. |
int |
indexOfAnyCharOutsideQuotion(java.lang.String sChars,
int fromWhere,
int maxToTest)
Searches any char contented in sChars, but skip over quotions while testing. |
int |
indexOfAnyString(java.lang.String[] listStrings,
int fromWhere,
int maxToTest,
int[] nrofFoundString,
java.lang.String[] foundString)
Returns the position of one of the chars in sChars within the part, started inside the part with fromIndex, returns -1 if the char is not found in the part started from 'fromIndex'. |
int |
indexOfNoChar(java.lang.String sChars)
Returns the position of the first char other than the chars in sChars within the part, returns -1 if all chars inside the parts are chars given by sChars. |
int |
indexOfNoChar(java.lang.String sChars,
int fromWhere)
Returns the position of the first char other than the chars in sChars within the part, started inside the part with fromIndex, returns -1 if all chars inside the parts started from 'fromIndex' are chars given by sChars. |
(package private) boolean |
isFound()
Deprecated. see found() |
int |
lastIndexOfAnyChar(java.lang.String sChars,
int fromWhere,
int maxToTest)
Returns the last position of one of the chars in sChars within the part of actual part from (fromIndex) to (fromIndex+maxToTest) or returs -1 if the char is not found in this part. |
StringPart |
len0end()
Sets the length to the end of the maximal part if the length is 0. |
StringPart |
lenBacktoNoChar(java.lang.String sChars)
Posits the end of the part before all of the chars given in the parameter string. |
int |
length()
Returns the valid lenght of the acutual part. |
int |
lengthMaxPart()
Returns the lenght of the maximal part from current position. |
StringPart |
lento(char cc)
Sets the endposition of the part of string to exclusively the char cc. |
StringPart |
lento(int len)
Sets the endposition of the part of string to the given chars after start. |
StringPart |
lento(java.lang.String ss)
Sets the endposition of the part of string to exclusively the given string. |
StringPart |
lento(java.lang.String ss,
int mode)
Sets the endposition of the part of string to exclusively the given string. |
StringPart |
lentoAnyChar(java.lang.String sChars)
Sets the length of the current part to any char content in sChars (terminate chars). |
StringPart |
lentoAnyChar(java.lang.String sChars,
int maxToTest)
Sets the length of the current part to any char content in sChars (terminate chars). |
StringPart |
lentoAnyChar(java.lang.String sChars,
int maxToTest,
int mode)
Sets the length of the current part to any char content in sChars (terminate chars). |
StringPart |
lentoAnyCharOutsideQuotion(java.lang.String sChars,
int maxToTest)
Sets the length of the current part to any char content in sChars (terminate chars), but skip over quotions while testing. |
StringPart |
lentoAnyNonEscapedChar(java.lang.String sCharsEnd,
int maxToTest)
Sets the len to the first position of any given char, but not if the char is escaped. |
StringPart |
lentoAnyString(java.lang.String[] strings,
int maxToTest)
Sets the length of the current part to any terminate string given in sString. |
StringPart |
lentoAnyString(java.lang.String[] strings,
int maxToTest,
int mode)
Sets the length of the current part to any terminate string given in sString. |
void |
lentoAnyStringWithIndent(java.lang.String[] strings,
java.lang.String sIndentChars,
int maxToTest,
java.lang.StringBuilder buffer)
Sets the length of the current part to any terminate string given in sString. |
StringPart |
lentoIdentifier()
Sets the endposition of the part of string to the end of the identifier which is beginning on start. |
StringPart |
lentoIdentifier(java.lang.String additionalStartChars,
java.lang.String additionalChars)
Sets the endposition of the part of string to the end of the identifier which is beginning on start. |
StringPart |
lentoNonEscapedString(java.lang.String sEnd,
int maxToTest)
Sets the len to the first position of any given char, but not if the char is escaped. |
StringPart |
lentoQuotionEnd(char sEndQuotion,
int maxToTest)
Sets the length of the current part to the end of the quotion. |
static java.lang.String |
replace(java.lang.String src,
java.lang.String[] placeholder,
java.lang.String[] value,
java.lang.StringBuilder dst)
Replaces up to 20 placeholder with a given content. |
StringPart |
scan(java.lang.String sTestP)
scan next content, test the requested String. |
private long |
scanDigits(boolean bHex,
int maxNrofChars)
Scans if it is a integer number, contains exclusively of digits 0..9 |
private boolean |
scanEntry()
|
StringPart |
scanFloatNumber()
Scans an float expression. |
StringPart |
scanHex(int maxNrofChars)
Scans a sequence of hex chars a hex number. |
StringPart |
scanHexOrDecimal(int maxNrofChars)
Scans a integer number possible as hex, or decimal number. |
StringPart |
scanIdentifier()
|
StringPart |
scanIdentifier(java.lang.String additionalStartChars,
java.lang.String additionalChars)
|
StringPart |
scanInteger()
Scans an integer expression with possible sign char '-' at first. |
boolean |
scanOk()
Test the result of scanning and set the scan Pos Ok, if current scanning was ok. |
StringPart |
scanPositivInteger()
Scanns a integer number as positiv value without sign. |
StringPart |
scanQuotion(java.lang.String sQuotionmarkStart,
java.lang.String sQuotionMarkEnd,
java.lang.String[] sResult)
|
StringPart |
scanQuotion(java.lang.String sQuotionmarkStart,
java.lang.String sQuotionMarkEnd,
java.lang.String[] sResult,
int maxToTest)
|
StringPart |
scanStart()
|
StringPart |
seek(char cSeek,
int mode)
Searchs the given character inside the valid part, posits the start of the part to the begin of the searched char. |
StringPart |
seek(int nr)
Displaces the start of the part for some chars to left or to right. |
StringPart |
seek(java.lang.String sSeek,
int mode)
Searchs the given String inside the valid part, posits the start of the part to the begin of the searched string. |
StringPart |
seekAnyString(java.lang.String[] strings,
int[] nrofFoundString)
Searchs the given String inside the valid part, posits the start of the part to the begin of the searched string. |
protected StringPart |
seekBegin()
Displaces the start of the part to the leftest possible start. |
StringPart |
seekNoChar(java.lang.String sChars)
Posits the start of the part after all of the chars given in the parameter string. |
StringPart |
seekNoWhitespace()
Displaces the start of the part to the first char it is no whitespace. |
StringPart |
seekNoWhitespaceOrComments()
Displaces the start of the part to the first char it is no whitespace or comment. |
StringPart |
setBeginMaxPart()
Sets the start of the maximal part to the actual start of the valid part. |
void |
setCurrentPosition(long pos)
Sets the current position at a fix position inside the maxPart. |
boolean |
setIgnoreComment(boolean bSet)
Set the mode of ignoring comments. |
boolean |
setIgnoreComment(java.lang.String sStart,
java.lang.String sEnd)
Set the character string of inline commentmode of ignoring comments. |
boolean |
setIgnoreEndlineComment(boolean bSet)
Set the mode of ignoring comments to end of line. |
boolean |
setIgnoreEndlineComment(java.lang.String sStart)
Set the character string introducing the comments to end of line. |
boolean |
setIgnoreWhitespaces(boolean bSet)
Set the mode of ignoring whitespaces. |
StringPart |
setLengthMax()
Sets the length to the end of the maximal part. |
protected StringPart |
skipWhitespaceAndComment()
Deprecated. see seekNoWhitespaceOrComments() |
boolean |
startsWith(java.lang.String sCmp)
compares the Part of string with the given string. |
java.lang.String |
substring(int pos,
int posendP)
Gets a substring inside the maximal part pos position of start relative to maxPart posend exclusive position of end. |
private void |
throwIndexOutOfBoundsException(java.lang.String sMsg)
Central mehtod to invoke excpetion, usefull to set a breakpoint in debug or to add some standard informations. |
java.lang.String |
toString()
Returns the actual part of the string. |
(package private) StringPart |
trim()
Trims all leading and trailing whitespaces within the part. |
(package private) StringPart |
trimComment()
Trims a java- or C-style line-comment from end of part and all leading and trailing whitespaces. |
StringPart |
xxxseekEnd(java.lang.String sSeek)
Searchs the given String inside the valid part, posits the start of the part after the end of the searched string. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected int start
protected int end
protected int startMin
abcdefghijklmnopqrstuvwxyz Sample of the whole associated String
===================== The === indicates the maximal part
----------- The --- indicates the valid part before operation
++++++++ The +++ indicates the valid part after operation
protected int endMax
java.lang.String content
protected int nLineCt
protected boolean bCurrentOk
protected boolean bStartScan
scanOk() or after scanStart()
protected int startLast
protected int endLast
protected int startScan
boolean bFound
found().
protected final long[] nLastIntegerNumber
private int idxLastIntegerNumber
protected final double[] nLastFloatNumber
private int idxLastFloatNumber
protected java.lang.String sLastString
public static final int seekEnd
private static final int mSeekBackward_
private static final int mSeekToLeft_
public static final int seekToLeft
public static final int seekBack
public static final int seekNormal
protected int bitMode
protected static final int mSkipOverWhitespace_mode
protected static final int mSkipOverCommentInsideText_mode
protected static final int mSkipOverCommentToEol_mode
java.lang.String sCommentStart
java.lang.String sCommentEnd
java.lang.String sCommentToEol
public static final char cStartOfText
public static final char cEndOfText
| Constructor Detail |
|---|
public StringPart()
public StringPart(java.lang.String content)
content - The content, that String is associated by this.public StringPart(StringPart src)
abcdefghijklmnopqrstuvwxyz The associated String
---------------- The valid part of src
================ The maximal part and initial the valid part of this
+++++ ++++ Possible valid parts of this after some operations
++++ +++ Possible also
+++++ ++++ +++ Never valid parts of this after operations because they exceeds the borders of maximal part.
src - The given StringPart.| Method Detail |
|---|
public StringPart assign(java.lang.String content)
content - The content.
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();public StringPart assign(StringPart src)
abcdefghijklmnopqrstuvwxyz The associated String
---------------- The valid part of src
================ The maximal part and initial the valid part of this
+++++ ++++ Possible valid parts of this after some operations
++++ +++ Possible also
+++++ ++++ +++ Never valid parts of this after operations because they exceeds the borders of maximal part.
src - The given StringPart.
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();public StringPart assignFromEnd(StringPart src)
abcdefghijklmnopqrstuvwxyz The associated String
===================== The maximal part of src
------ The valid part of src
============= The maximal and initialy the valid part of this
src - The source of the operation.
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();public boolean setIgnoreComment(boolean bSet)
bSet - If true than ignore, if false than comments are normal input to parse.
public boolean setIgnoreComment(java.lang.String sStart,
java.lang.String sEnd)
sStart - Start character string of a inline commentsEnd - End character string of a inline comment
public boolean setIgnoreEndlineComment(boolean bSet)
bSet - If true than ignore, if false than comments are normal input to parse.
public boolean setIgnoreEndlineComment(java.lang.String sStart)
sStart - String introducing end line comment
public boolean setIgnoreWhitespaces(boolean bSet)
bSet - If true than ignore, if false than comments are normal input to parse.
public StringPart setBeginMaxPart()
abcdefghijklmnopqrstuvwxyz The associated String
================ The maximal part before operation
------ The actual part
=========== The maximal part after operation
src - The given StringPart.
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();public StringPart fromEnd()
abcdefghijklmnopqrstuvwxyz The associated String
================= The maximal part
----- The valid part before
+++++ The valid part after.
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();public int getLineCt()
public int getLen()
public int length()
public int lengthMaxPart()
public StringPart lento(int len)
throws java.lang.IndexOutOfBoundsException
len - The new length. It must be positive.
this to concat some operations.
java.lang.IndexOutOfBoundsException - if the len is negativ or greater than the position endMax.public StringPart lento(char cc)
abcdefghijklmnopqrstuvwxyz The associated String
================= The maximal part of src
----- The valid part of src before calling the method
+ after calling lento('w') the end is set to start
position, the length() is 0, because the 'w' is outside.
++++++++++ calling set0end() is possible and produce this result.
cc - char to determine the exclusively end char.
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();public StringPart lento(java.lang.String ss)
ss - string to determine the exclusively end char.
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();
public StringPart lento(java.lang.String ss,
int mode)
ss - string to determine the exclusively end char.mode - Mode of seeking the end, seekEnd or 0 is possible.
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();public StringPart lentoIdentifier()
abcd this is a part uvwxyz The associated String
===================== The border of valid parts of src
------- The valid part of the src before calling the method
+++ after calling lentoIdentifier(). The start position
is not effected. That's why the identifier-part is only "his".
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();
public StringPart lentoIdentifier(java.lang.String additionalStartChars,
java.lang.String additionalChars)
additionalChars - String of additinal chars there are also accept
as identifier chars.lentoIdentifier().
public StringPart lentoAnyNonEscapedChar(java.lang.String sCharsEnd,
int maxToTest)
scanOk() before guarantees that the method works.
sCharsEnd - Assembling of chars determine the end of the part.
public StringPart lentoNonEscapedString(java.lang.String sEnd,
int maxToTest)
scanOk() before guarantees that the method works.
sCharsEnd - Assembling of chars determine the end of the part.public StringPart seek(int nr)
abcdefghijklmnopqrstuvwxyz The associated String
================= The maximal part
----- The valid part before
+++++++ The valid part after calling seek(-2).
+++ The valid part after calling seek(2).
+ The valid part after calling seek(5).
The start is set to end, the lenght() is 0.
++++++++++++ The valid part after calling seek(-5).
nr - of positions to displace. Negative: Displace to left.
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();public StringPart seekNoWhitespace()
abcdefghijklmnopqrstuvwxyz The associated String
================= The maximal part
---------- The valid part before
+++++++ The valid part after, if 'defg' are whitespaces
++++++++++ The valid part after is the same as before, if no whitespace at current position
. The valid part after is emtpy, if only whitespaces re found.
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();protected StringPart skipWhitespaceAndComment()
seekNoWhitespaceOrComments()
public StringPart seekNoWhitespaceOrComments()
abcdefghijklmnopqrstuvwxyz The associated String
================= The maximal part
---------- The valid part before
+++++++ The valid part after, if 'defg' are whitespaces
++++++++++ The valid part after is the same as before, if no whitespace at current position
. The valid part after is emtpy, if only whitespaces re found.
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();boolean isFound()
found()
public boolean found()
protected StringPart seekBegin()
abcdefghijklmnopqrstuvwxyz The associated String
================= The maximal part
----- The valid part before
++++++++++++ The valid part after calling seekBegin().
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();
public StringPart seek(java.lang.String sSeek,
int mode)
that is a liststring and his part The associated String
============================= The maximal part
---------------------- The valid part before
+++++++++++++++++ The valid part after seek("is",StringPart.seekNormal).
+++++++++++++++ The valid part after seek("is",StringPart.seekEnd).
++ The valid part after seek("is",StringPart.back).
. The valid part after seek("is",StringPart.back + StringPart.seekEnd).
+++++++++++++++++++++++ The valid part after seek("is",StringPart.seekToLeft).
+++++++++++++++++++++ The valid part after seek("is",StringPart.seekToLeft + StringPart.seekEnd).
++++++++++++++++++++++++++ The valid part after seek("xx",StringPart.seekToLeft).
. The valid part after seek("xx",StringPart.seekNormal)
or seek("xx",StringPart.back).
sSeek - The string to search for.mode - Mode of seeking, use ones of back, seekToLeft, seekNormal, added with seekEnd.
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();
public StringPart seekAnyString(java.lang.String[] strings,
int[] nrofFoundString)
seek(String sSeek, int mode)
strings - List of String contains the strings to search.nrofFoundString - If given, [0] is set with the number of the found String in listStrings,
count from 0. This array reference may be null, then unused.
public StringPart seek(char cSeek,
int mode)
cSeek - The character to search for.mode - Mode of seeking, use ones of back, seekToLeft, seekNormal, added with seekEnd.
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();public StringPart xxxseekEnd(java.lang.String sSeek)
sample: seek("fgh") results is:
abcdefghijabcdefghijklmnopq
before: ============
after: ===
not: =============
If the string is not found, the start is posit on the actual end. The length()-method supplies 0.
Methods such fromEnd() are not interacted from the result of the searching.
The rule is: seek()-methods only shifts the start position.
sSeek - The string to search for.
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();public StringPart seekNoChar(java.lang.String sChars)
sample: seekNoChar("123") result is:
12312312312abcd12312efghij123123
before: ==========================
after: ===================
sChars - String with the chars to overread.
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();
public int indexOfAnyChar(java.lang.String sChars,
int fromWhere,
int maxToTest)
sChars - contents some chars to find. The char with codefromIndex - start of search within the part.maxToTest - maximal numbers of chars to test. It may be Integer.MAX_VALUE.
public int lastIndexOfAnyChar(java.lang.String sChars,
int fromWhere,
int maxToTest)
sChars - contents some chars to find. The char with codefromIndex - start of search within the part.maxToTest - maximal numbers of chars to test. It may be Integer.MAX_VALUE.
public int indexOfAnyString(java.lang.String[] listStrings,
int fromWhere,
int maxToTest,
int[] nrofFoundString,
java.lang.String[] foundString)
listStrings - contains some Strings to find.fromWhere - start of search within the part.maxToTest - maximal numbers of chars to test. It may be Integer.MAX_VALUE.nrofFoundString - If given, [0] is set with the number of the found String in listStrings,
count from 0. This array reference may be null, then unused.foundString - If given, [0] is set with the found String. This array reference may be null.
public int indexOfAnyCharOutsideQuotion(java.lang.String sChars,
int fromWhere,
int maxToTest)
abc "yxz" end:zxyThe calling is
lentoAnyCharOutsideQuotion("xyz", 20);
The result current part isabc "yxz" end:because the char 'z' is found first as the end char, but outside the quoted string "xyz".
sChars - One of this chars is a endchar. It may be null: means, every chars is a endchar.fromWhere - Offset after start to start search. It may be 0 in many cases.maxToTest -
public int indexEndOfQuotion(char cEndQuotion,
int fromWhere,
int maxToTest)
fromWhere - Offset after start to start search.
It may be 0 if the quotion starts at start, it is the position of the left
quotion mark.maxToTest - Limit for searching, offset from start. It may be Integer.MAX_INT
public int indexOfAnyChar(java.lang.String sChars)
sChars - contents some chars to find.
public int indexOfNoChar(java.lang.String sChars,
int fromWhere)
sChars - contents the chars to overread.fromIndex - start of search within the part.
public int indexOfNoChar(java.lang.String sChars)
sChars - contents the chars to overread.
public StringPart lentoAnyChar(java.lang.String sChars,
int maxToTest)
sChars - Some chars searched as terminate char for the actual part.maxToTest - Maximum of chars to test. If the endchar isn't find inside this number of chars,
the actual length is set to 0.mode - Possible values are StringPart.seekBack or StringPart.seekNormal = 0.
public StringPart lentoAnyChar(java.lang.String sChars,
int maxToTest,
int mode)
sChars - Some chars searched as terminate char for the actual part.maxToTest - Maximum of chars to test. If the endchar isn't find inside this number of chars,
the actual length is set to 0.mode - Possible values are StringPart.seekBack or StringPart.seekNormal = 0.
public StringPart lentoAnyString(java.lang.String[] strings,
int maxToTest)
sString - The first char is the separator.maxToTest - Maximum of chars to test. If the endchar isn't find inside this number of chars,
the actual length is set to 0.
public StringPart lentoAnyString(java.lang.String[] strings,
int maxToTest,
int mode)
sString - The first char is the separator.maxToTest - Maximum of chars to test. If the endchar isn't find inside this number of chars,
the actual length is set to 0.mode - possible values are StrinPart.seekNormal or StringPart.seekEnd.
public void lentoAnyStringWithIndent(java.lang.String[] strings,
java.lang.String sIndentChars,
int maxToTest,
java.lang.StringBuilder buffer)
. /** This is a comment . * continued in a next line with indent. . but it is able that the user doesn't respect the indentation . also with to large indentation, . * *The second asterix should not be skipped.From this text passage the result is:
.This is a comment .continued in a next line with indent. .but it is able that the user doesn't respect the indentation .also with to large indentation, .*The second asterix should not be skipped.Using the result it is possible to detect paragraph formatting in wikipedia style (see vishia.xml.ConvertWikistyleTextToXml.java)
strings - List of type String, containing the possible end strings.iIndentChars - possible chars inside a skipped indentation. If the last char is space (" "),
also spaces after the indentation of the first line are skipped.maxToTest - Maximum of chars to test. If the endchar isn't find inside this number of chars,
the actual length is set to 0.buffer - The buffer where the found String is stored. The stored String has no indentations.
public StringPart lentoAnyCharOutsideQuotion(java.lang.String sChars,
int maxToTest)
abc "yxz" ende:zxyThe calling is
lentoAnyCharOutsideQuotion("xyz", 20);
The result current part isabc "yxz" ende:because the char 'z' is found first as the end char, but outside the quoted string "xyz".
sChars - Some chars searched as terminate char for the actual part.maxToTest - Maximum of chars to test. If the endchar isn't find inside this number of chars,
the actual length is set to 0.
public StringPart lentoQuotionEnd(char sEndQuotion,
int maxToTest)
sEndQuotion - The char determine the end of quotion, it may be at example " or ' or >.maxToTest - Maximum of chars to test. If the endchar isn't find inside this number of chars,
the actual length is set to 0.
public StringPart lentoAnyChar(java.lang.String sChars)
sChars - Some chars searched as terminate char for the actual part.
public StringPart len0end()
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();public StringPart setLengthMax()
public StringPart lenBacktoNoChar(java.lang.String sChars)
sample: lentoBacktoNoChar("123") result is:
1231231231abcd12312efghij123123123klmnopq
before: ==========================
after: =====================
sChars - String with the chars to overread.
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();StringPart trim()
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();StringPart trimComment()
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();public int indexOf(char ch)
ch - character to find.
The - method throws no IndexOutOfBoundaryException.
It is the same behavior like String.indexOf(char, int fromEnd).
public int indexOf(char ch,
int fromIndex)
ch - character to find.fromIndex - start of search within the part.
The - method throws no IndexOutOfBoundaryException. If the value of fromIndex
is negativ or greater than the end position, -1 is returned (means: not found).
It is the same behavior like String.indexOf(char, int fromEnd).public int indexOf(java.lang.String sCmp)
abcdefgabcdefghijk
part: =============
sCmp - string to find
public int indexOf(java.lang.String sCmp,
int fromIndex,
int maxToTest)
abcdefgabcdefghijk
part: =============
sCmp - string to find
public boolean equals(java.lang.String sCmp)
public boolean startsWith(java.lang.String sCmp)
sCmp - The text to compare.public StringPart scan(java.lang.String sTestP)
seekNoWhitespaceOrComments() .
sTest - String to test
public boolean scanOk()
public StringPart scanQuotion(java.lang.String sQuotionmarkStart,
java.lang.String sQuotionMarkEnd,
java.lang.String[] sResult)
sQuotionmarkStart - sQuotionMarkEnd - sResult -
public StringPart scanQuotion(java.lang.String sQuotionmarkStart,
java.lang.String sQuotionMarkEnd,
java.lang.String[] sResult,
int maxToTest)
sQuotionmarkStart - sQuotionMarkEnd - sResult - maxToTest -
private long scanDigits(boolean bHex,
int maxNrofChars)
bHex - true: scan hex Digits and realize base 16, otherwise realize base 10.
public StringPart scanStart()
private boolean scanEntry()
public StringPart scanPositivInteger()
throws java.text.ParseException
getLastScannedIntegerNumber().
There can stored upto 5 numbers. If more as 5 numbers are stored yet,
an exception is thrown.
java.text.ParseException - if the buffer is not free to hold an integer number.
public StringPart scanInteger()
throws java.text.ParseException
getLastScannedIntegerNumber().
There can stored upto 5 numbers. If more as 5 numbers are stored yet,
an exception is thrown.
java.text.ParseException - if the buffer is not free to hold an integer number.
public StringPart scanFloatNumber()
throws java.text.ParseException
getLastScannedIntegerNumber().
There can stored upto 5 numbers. If more as 5 numbers are stored yet,
an exception is thrown.
java.text.ParseException - if the buffer is not free to hold an integer number.
public StringPart scanHex(int maxNrofChars)
throws java.text.ParseException
getLastScannedIntegerNumber().
There can stored upto 5 numbers. If more as 5 numbers are stored yet,
an exception is thrown.
java.text.ParseException - if the buffer is not free to hold an integer number.
public StringPart scanHexOrDecimal(int maxNrofChars)
throws java.text.ParseException
getLastScannedIntegerNumber().
There can stored upto 5 numbers. If more as 5 numbers are stored yet,
an exception is thrown.
maxNrofChars - The maximal number of chars to scan, if <=0 than no limit.
java.text.ParseException - if the buffer is not free to hold an integer number.public StringPart scanIdentifier()
public StringPart scanIdentifier(java.lang.String additionalStartChars,
java.lang.String additionalChars)
additionalStartChars - additionalChars -
public long getLastScannedIntegerNumber()
throws java.text.ParseException
java.text.ParseException - if called though no scan routine was called.
public double getLastScannedFloatNumber()
throws java.text.ParseException
java.text.ParseException - if called though no scan routine was called.public java.lang.String getLastScannedString()
public java.lang.String getCircumScriptionToAnyChar(java.lang.String sCharsEnd)
sCharsEnd - Assembling of chars determine the end of the part.public java.lang.String getCircumScriptionToAnyCharOutsideQuotion(java.lang.String sCharsEnd)
private java.lang.String getCircumScriptionToAnyChar_p(java.lang.String sCharsEnd,
boolean bOutsideQuotion)
public long getCurrentPosition()
public void setCurrentPosition(long pos)
pos - the absolute position
public java.lang.String substring(int pos,
int posendP)
public java.lang.String getCurrent(int nChars)
nChars - number of chars to return. If the number of chars available in string
is less than the required number, only the available string is returned.public char getCurrentChar()
public int getCurrentColumn()
public java.lang.String getCurrentPart()
public java.lang.String getLastPart()
public java.lang.String getCurrentPart(int maxLength)
public java.lang.String toString()
String xy = "abc" + spStringPart + "xyz";
In this case the StringPart is accept as a Object and the Object.toString() is called. This method is here implemented.
So a StringPart is usualable directly in concatation.
toString in class java.lang.Objectpublic java.lang.String debugString()
"CONTENT_FROM_BEGIN<<<34,45>>>CONTENT_PART<<<"whereat
private void throwIndexOutOfBoundsException(java.lang.String sMsg)
throws java.lang.IndexOutOfBoundsException
sMsg -
java.lang.IndexOutOfBoundsException
public static java.lang.String replace(java.lang.String src,
java.lang.String[] placeholder,
java.lang.String[] value,
java.lang.StringBuilder dst)
src - The source String, it may be a line.placeholder - An array of strings, any string of them may be found in the src.value - An array of strings appropriate to the placeholder. Any found placeholder
will be substitute with that string.dst - A given StringBuilder-instance. If null, then a StringBuilder will be created here
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||