|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--xbn.XBNObject | +--xbn.string.escape.EscapeUnescapeString | +--xbn.string.escape.EscapeString
Escape characters in a string.
Source code: EscapeString.java
"Escape", meaning: Add an escape character immediately before each character that needs to be escaped.
Fields inherited from class xbn.XBNObject |
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP |
Constructor Summary | |
EscapeString(EscapeString escape_string)
Create a full copy of the provided EscapeString. |
|
EscapeString(ESConfig es_config)
Create an EscapeString. |
Method Summary | |
void |
escapeSB(StringBuffer str_buffer,
int i_idxErrOffset)
Escape all characters that need to be. |
void |
escapeSOB(StringOrBuffer str_orBfr,
int i_idxErrOffset)
Escape all characters that need to be. |
String |
get(String s_tr)
Escape all characters that need to be. |
String |
get(String s_tr,
int i_idxErrOffset)
Get a copy of the string after all characters that need to be escaped, are. |
int |
getCharsAdded()
How many escape characters have been added to the string so far? |
void |
resetAddedCharCount()
Reset the counter that keeps track of how many escape characters have been added to the string. |
Methods inherited from class xbn.string.escape.EscapeUnescapeString |
getESConfig, getIdx1stUnesc2BEsc, getIdx1stUnesc2BEsc, getIdx1stUnesc2BEsc, getIdx1stUnesc2BEsc, getIdx1stUnesc2BEsc, getIdx1stUnesc2BEsc, getIdx1stUnesc2BEsc, getIdx1stUnesc2BEsc, getIdx1stUnesc2BEsc, isEscaped, isEscaped, isEscaped |
Methods inherited from class xbn.XBNObject |
getXMsgPrefix, sop, sopl, sopl, throwAX, throwAXIfBadStr, throwAXIfNull, throwAXSpoof |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public EscapeString(ESConfig es_config)
Create an EscapeString.
Equal to EscapeUnescapeString(es_config)
public EscapeString(EscapeString escape_string)
Create a full copy of the provided EscapeString.
Equal to EscapeUnescapeString(escape_string)
Method Detail |
public final int getCharsAdded()
How many escape characters have been added to the string so far?
Before escaping a string, no escape characters exist (well, unescaped escape characters might). When the string is escaped, each character that needs to be escaped is. How is the character escaped? By adding an escape character right before it. This function tells you how many escape characters have been added since this object was created (regardless how many times the string was or was not escaped).
See resetAddedCharCount.
public final void resetAddedCharCount()
Reset the counter that keeps track of how many escape characters have been added to the string. Calling this causes getCharsAdded to return zero.
public final String get(String s_tr)
Escape all characters that need to be.
get(s_tr, 0)
public String get(String s_tr, int i_idxErrOffset)
Get a copy of the string after all characters that need to be escaped, are.
escapeSOB([UtilString].getSOBS(s_tr, "get"), i_idxErrOffset)
public void escapeSB(StringBuffer str_buffer, int i_idxErrOffset)
Escape all characters that need to be.
Equal to escapeSOB([UtilStringBuffer].getSOBSB(str_buffer, "escapeSB"), i_idxErrOffset).getStringBuffer()
public final void escapeSOB(StringOrBuffer str_orBfr, int i_idxErrOffset)
Escape all characters that need to be. This adds the escape character in front of every characacter that needs to be escaped (including the escape character itself). getCharsAdded keeps track of how many escape characters have been added so far.. See ESConfig for more information.
As far as I can see, as long as str_buffer is non-nul, this function will not throw an exception for any reason.
str_buffer
- Contains the string that needs to have its characters escaped. May not be null.i_idxErrOffset
- For use only in error messages. This number is the offset to make the error messages display the proper--overall--character array index. When str_buffer is actually a part of a larger string, use this to make error messages display the original character array index, as if str_buffer were still part of the larger string.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1997-2003, Jeff Epstein, All Rights Reserved. See top of source code files for copyright notice.
http://sourceforge.net/projects/xbnjava