A mutable string, that provides public access to its internal buffer and fields. First of all, the existence of this class is motivated to reach a certain level of compatibility between source code that uses the ALib across different languages (currently Java, C# and C++) whose implementations share a similar AString class.
As the given C#/Java StringBuilder/Buffer classes are either "sealed" and/or do not provide direct access to the internal buffer, to avoid conversion to new immutable strings in certain situations, the A-Worx Library implements its own string class. More complex functions, like extended formatting operations are not supported and remain the domain of the language specific class libraries.
Null-state:
Class AString is 'nullable', which means, that an instance may have no internal character array allocated. If constructed with zero size, a null pointer or another AString which is 'nulled' (but not a non-null, zero length string object of any type), the allocation size is 0. Nevertheless, method Buffer will return a valid empty char[] (a static singleton). This has the advantage that in many situations the null-state is not needed to handled specially (those cases where the difference between a nulled and an empty string is irrelevant). Consequently, it makes a difference if an AString is constructed using AString() or "AString(\""). This allows to differentiate between 'nulled' AStrings and empty AStrings, which is quite handy in certain situations. An object that was filled already can be reset to represent null by either assigning a nulled AString, by invoking SetBuffer(0) or by invoking SetNull on the instance. See also methods IsNull, IsNotNull and Capacity. The methods Equals and CompareTo allow null
comparisons. e.g. an nulled AString equals to another nulled AString but not to a zero length, not nulled AString.
Non-checking methods
In general, AString methods are internally checking the provided parameters. For example, method _( AString src, int regionStart, int regionLength = int.MaxValue) is adjusting the provided region information to fit to the size of the provided AString.
Chances are high, that the code invoking this method "knows" about the correctness of the region. In this case, the checks are redundant.
For avoiding unnecessary checks, various methods are provided by AString that omit such checks. These methods share the same name as the standard one, with the suffix "_NC" appended (NC stands for "no checks").
In the sample above, if the calling code was sure about the parameters regionStart and regionLength being in the bounds of src, method _NC( AString src, int regionStart, int regionLength ) can be used.
Public Static Methods | |
static bool | IsNull (Object o) |
static bool | IsNullOrEmpty (AString ms) |
Public Methods | |
Constructors and Destructor | |
AString () | |
AString (int size) | |
AString (AString src, int regionStart=0, int regionLength=int.MaxValue) | |
AString (Substring src) | |
AString (String src, int regionStart=0, int regionLength=int.MaxValue) | |
AString (StringBuilder src, int regionStart=0, int regionLength=int.MaxValue) | |
Memory allocation and buffer access | |
char[] | Buffer () |
void | SetBuffer (int newCapacity) |
void | EnsureRemainingCapacity (int spaceNeeded) |
int | Capacity () |
void | SetNull () |
bool | IsNull () |
bool | IsNotNull () |
int | SetLength (int newLength) |
void | SetLength_NC (int newLength) |
int | Length () |
bool | IsEmpty () |
bool | IsNotEmpty () |
Insert and Delete | |
AString | Clear () |
AString | _ () |
AString | InsertAt (char[] src, int cStart, int cLength, int pos) |
AString | InsertAt (AString src, int pos) |
AString | InsertAt (Substring src, int pos) |
AString | InsertAt (String src, int pos) |
AString | InsertAt (StringBuilder src, int pos) |
AString | InsertChars (char c, int qty, int pos) |
AString | InsertChars (char c, int qty) |
AString | ReplaceSubstring (char[] src, int cStart, int cLength, int regionStart, int regionLength) |
AString | ReplaceSubstring (AString src, int regionStart, int regionLength) |
AString | ReplaceSubstring (Substring src, int regionStart, int regionLength) |
AString | ReplaceSubstring (String src, int regionStart, int regionLength) |
AString | ReplaceRegion (char c, int regionStart, int regionLength) |
AString | Delete (int regionStart, int regionLength=int.MaxValue) |
AString | Delete_NC (int regionStart, int regionLength) |
AString | DeleteStart (int regionLength) |
AString | DeleteStart_NC (int regionLength) |
AString | DeleteEnd (int regionLength) |
AString | DeleteEnd_NC (int regionLength) |
AString | Trim (char[] trimChars=null) |
int | TrimAt (int idx, char[] trimChars=null) |
AString | TrimStart (char[] trimChars=null) |
AString | TrimEnd (char[] trimChars=null) |
Basic formatting | |
AString | NewLine () |
AString | Tab (int tabSize, int minPad=1, char tabChar=' ') |
AString | Field (int size=-1, Alignment alignment=Alignment.Right, char padChar=' ', int fieldStart=int.MaxValue) |
Appending characters and strings | |
AString | _NC (char[] src, int regionStart, int regionLength) |
AString | _ (Object src) |
AString | _NC (Object src) |
AString | _ (AString src) |
AString | _ (AString src, int regionStart, int regionLength=int.MaxValue) |
AString | _NC (AString src) |
AString | _NC (AString src, int regionStart, int regionLength) |
AString | _ (char[] src) |
AString | _ (char[] src, int regionStart, int regionLength=int.MaxValue) |
AString | _ (Substring substring) |
AString | _NC (Substring src) |
AString | _ (String src) |
AString | _ (String src, int regionStart, int regionLength=int.MaxValue) |
AString | _NC (String src) |
AString | _NC (String src, int regionStart, int regionLength) |
AString | _ (StringBuilder src) |
AString | _ (StringBuilder src, int regionStart, int regionLength=int.MaxValue) |
AString | _ (char c) |
Comparison | |
int | CompareTo (String needle, Case sensitivity=Case.Sensitive, int needleRegionStart=0, int needleRegionLength=int.MaxValue, int regionStart=0, int regionLength=int.MaxValue) |
int | CompareTo (AString needle, Case sensitivity=Case.Sensitive, int needleRegionStart=0, int needleRegionLength=int.MaxValue, int regionStart=0, int regionLength=int.MaxValue) |
int | CompareTo (char[] needle, Case sensitivity=Case.Sensitive, int needleRegionStart=0, int needleRegionLength=int.MaxValue, int regionStart=0, int regionLength=int.MaxValue) |
int | CompareTo (Substring needle, Case sensitivity=Case.Sensitive, int regionStart=0, int regionLength=int.MaxValue) |
bool | ContainsAt (String needle, int pos, Case sensitivity=Case.Sensitive) |
bool | ContainsAt (char[] needle, int needleStart, int needleLength, int pos, Case sensitivity=Case.Sensitive) |
bool | ContainsAt (AString needle, int pos, Case sensitivity=Case.Sensitive) |
bool | ContainsAt (Substring needle, int pos, Case sensitivity=Case.Sensitive) |
bool | StartsWith (String needle, Case sensitivity=Case.Sensitive) |
bool | StartsWith (AString needle, Case sensitivity=Case.Sensitive) |
bool | StartsWith (Substring needle, Case sensitivity=Case.Sensitive) |
bool | EndsWith (String needle, Case sensitivity=Case.Sensitive) |
bool | EndsWith (AString needle, Case sensitivity=Case.Sensitive) |
bool | EndsWith (Substring needle, Case sensitivity=Case.Sensitive) |
override bool | Equals (Object o) |
bool | Equals (AString compareString, Case sensitivity=Case.Sensitive) |
bool | Equals (String compareString, Case sensitivity=Case.Sensitive) |
bool | Equals (Substring compareString, Case sensitivity=Case.Sensitive) |
bool | Equals (Object compareString, Case sensitivity=Case.Sensitive) |
Search | |
int | IndexOf (char needle, int startIdx=0) |
int | IndexOfOrLength (char needle) |
int | IndexOfOrLength (char needle, int startIdx) |
int | IndexOf (String needle, int startIdx=0, Case sensitivity=Case.Sensitive) |
int | IndexOf (AString needle, int startIdx=0, Case sensitivity=Case.Sensitive) |
int | IndexOf (Substring needle, int startIdx=0, Case sensitivity=Case.Sensitive) |
int | IndexOfAny (char[] needles, Inclusion inclusion, int startIdx=0) |
int | LastIndexOf (char needle, int startIndex=int.MaxValue) |
int | LastIndexOfAny (char[] needles, Inclusion inclusion, int startIdx=int.MaxValue) |
Replace | |
int | SearchAndReplace (char needle, char replacement, int startIdx=0) |
int | SearchAndReplace (String searchStr, String newStr, int startIdx=0, int maxReplacements=int.MaxValue, Case sensitivity=Case.Sensitive) |
int | SearchAndReplace (AString searchStr, AString newStr, int startIdx=0, int maxReplacements=int.MaxValue, Case sensitivity=Case.Sensitive) |
AString | SearchAndReplaceAll (AString searchStr, AString newStr, int startIdx=0, int maxReplacements=int.MaxValue, Case sensitivity=Case.Sensitive) |
AString | SearchAndReplaceAll (String searchStr, String newStr, int startIdx=0, int maxReplacements=int.MaxValue, Case sensitivity=Case.Sensitive) |
AString | ToUpper (int regionStart=0, int regionLength=int.MaxValue) |
AString | ToLower (int regionStart=0, int regionLength=int.MaxValue) |
AString | Escape (Switch escape=Switch.On, int regionStart=0, int regionLength=int.MaxValue) |
Convert | |
AString | _ (int value, int overrideWidth=0, NumberFormat numberFormat=null) |
AString | _ (int value, NumberFormat numberFormat) |
AString | _ (uint value, int overrideWidth=0, NumberFormat numberFormat=null) |
AString | _ (uint value, NumberFormat numberFormat) |
AString | _ (long value, int overrideWidth=0, NumberFormat numberFormat=null) |
AString | _ (long value, NumberFormat numberFormat) |
AString | _ (ulong value, int overrideWidth=0, NumberFormat numberFormat=null) |
AString | _ (ulong value, NumberFormat numberFormat) |
AString | _Bin (ulong value, int overrideWidth=0, NumberFormat numberFormat=null) |
AString | _Bin (ulong value, NumberFormat numberFormat) |
AString | _Hex (ulong value, int overrideWidth=0, NumberFormat numberFormat=null) |
AString | _Hex (ulong value, NumberFormat numberFormat) |
AString | _Oct (ulong value, int overrideWidth=0, NumberFormat numberFormat=null) |
AString | _Oct (ulong value, NumberFormat numberFormat) |
AString | _ (double value, int overrideWidth=0, NumberFormat numberFormat=null) |
AString | _ (double value, NumberFormat numberFormat) |
override String | ToString () |
String | ToString (int regionStart, int regionLength=int.MaxValue) |
StringBuilder | ToString (StringBuilder result, int regionStart, int regionLength=int.MaxValue, bool appendMode=false) |
StringBuilder | ToString (StringBuilder result, bool appendMode=false) |
ulong | ParseDecDigits (int startIdx, out int newIdx) |
long | ParseInt (int startIdx, NumberFormat numberFormat, out int newIdx) |
long | ParseInt (int startIdx=0, NumberFormat numberFormat=null) |
long | ParseInt (int startIdx, out int newIdx) |
long | ParseInt (NumberFormat numberFormat, out int newIdx) |
long | ParseInt (NumberFormat numberFormat) |
long | ParseInt (out int newIdx) |
ulong | ParseDec (int startIdx, NumberFormat numberFormat, out int newIdx) |
ulong | ParseDec (int startIdx=0, NumberFormat numberFormat=null) |
ulong | ParseDec (int startIdx, out int newIdx) |
ulong | ParseDec (NumberFormat numberFormat, out int newIdx) |
ulong | ParseDec (NumberFormat numberFormat) |
ulong | ParseDec (out int newIdx) |
ulong | ParseBin (int startIdx, NumberFormat numberFormat, out int newIdx) |
ulong | ParseBin (int startIdx=0, NumberFormat numberFormat=null) |
ulong | ParseBin (int startIdx, out int newIdx) |
ulong | ParseBin (NumberFormat numberFormat, out int newIdx) |
ulong | ParseBin (NumberFormat numberFormat) |
ulong | ParseBin (out int newIdx) |
ulong | ParseHex (int startIdx, NumberFormat numberFormat, out int newIdx) |
ulong | ParseHex (int startIdx=0, NumberFormat numberFormat=null) |
ulong | ParseHex (int startIdx, out int newIdx) |
ulong | ParseHex (NumberFormat numberFormat, out int newIdx) |
ulong | ParseHex (NumberFormat numberFormat) |
ulong | ParseHex (out int newIdx) |
ulong | ParseOct (int startIdx, NumberFormat numberFormat, out int newIdx) |
ulong | ParseOct (int startIdx=0, NumberFormat numberFormat=null) |
ulong | ParseOct (int startIdx, out int newIdx) |
ulong | ParseOct (NumberFormat numberFormat, out int newIdx) |
ulong | ParseOct (NumberFormat numberFormat) |
ulong | ParseOct (out int newIdx) |
double | ParseFloat (int startIdx, NumberFormat numberFormat, out int newIdx) |
double | ParseFloat (int startIdx=0, NumberFormat numberFormat=null) |
double | ParseFloat (int startIdx, out int newIdx) |
double | ParseFloat (NumberFormat numberFormat, out int newIdx) |
double | ParseFloat (NumberFormat numberFormat) |
double | ParseFloat (out int newIdx) |
C# std library interface implementation | |
override int | GetHashCode () |
Protected Fields | |
char[] | buffer =CString.NullBuffer |
int | fieldReference =0 |
A marker for the start of the actual field. | |
int | hash =0 |
int | length =0 |
int | tabReference =0 |
The tab reference position. This is set when NewLine is invoked. | |
Protected Methods | |
bool | resizeRegion (int regionStart, int regionLength, int newLength) |
Character access | |
char? | this[int idx] [get, set] |
char | CharAt (int idx) |
char | CharAt_NC (int idx) |
void | SetCharAt (int idx, char c) |
void | SetCharAt_NC (int idx, char c) |
char | CharAtStart () |
char | CharAtStart_NC () |
char | CharAtEnd () |
char | CharAtEnd_NC () |
|
inline |
Constructor allocating a specific buffer size.
size | The initial size of the internal buffer. |
|
inline |
Constructor copying a region of a String.
src | The source String to copy from. |
regionStart | The start index in s to append. Defaults to 0. |
regionLength | The maximum length of the substring in s to append. Defaults to int.MaxValue. |
|
inline |
Constructor copying a region of a StringBuilder.
src | The source StringBuilder to copy. |
regionStart | The start index in ms to append. Defaults to 0. |
regionLength | The maximum length of the substring in ms to append. Defaults to int.MaxValue. |
|
inline |
Clear the Buffer. Same as Clear(), really just a synonym to allow short code in alignment with the various "Append" methods named _(src)
this
to allow concatenated calls.
|
inline |
Append the given character.
c | The character to append. |
this
to allow concatenated calls.
|
inline |
Append the given char[].
src | The source array. |
this
to allow concatenated calls.
|
inline |
Append a region of a char[].
src | The source array. |
regionStart | The start of the region in src to append. Defaults to 0. |
regionLength | The maximum length of the region in src to append. Defaults to int.MaxValue. |
this
to allow concatenated calls.
|
inline |
Formats and appends a double floating point value.
Parameter numberFormat defaults to null
, which denotes this method to use the static singleton found in NumberFormat.Computational. To generate output better readable for humans, provide NumberFormat.Global, or a customized object of that type.
See NumberFormat for more information on formatting options.
value | The value to append. |
overrideWidth | If not 0 (the default), overrides the output width otherwise specified in field NumberFormat.IntegralPartMinimumWidth. |
numberFormat | The format definition. Defaults to null . |
this
to allow concatenated calls.
|
inline |
Overloaded version of _(double,int,NumberFormat) which provides default parameter(s).
value | The value to append. |
numberFormat | The format definition. Defaults to null . |
this
to allow concatenated calls.
|
inline |
Format and append a signed 32-Bit integer value.
Parameter numberFormat defaults to null
, which denotes this method to use the static singleton found in NumberFormat.Computational. To generate output better readable for humans, provide NumberFormat.Global, or a customized object of that type.
See NumberFormat for more information on formatting options.
value | The value to append. |
overrideWidth | If not 0 (the default), overrides the output width otherwise specified in field NumberFormat.DecMinimumFieldWidth. |
numberFormat | The format definition. Defaults to null . |
this
to allow concatenated calls.
|
inline |
Overloaded version of _(int,int,NumberFormat) which provides default parameter(s).
value | The value to append. |
numberFormat | The format definition. Defaults to null . |
this
to allow concatenated calls.
|
inline |
Format and append a signed 64-Bit integer value.
Parameter numberFormat defaults to null
, which denotes this method to use the static singleton found in NumberFormat.Computational. To generate output better readable for humans, provide NumberFormat.Global, or a customized object of that type.
See NumberFormat for more information on formatting options.
value | The value to append. |
overrideWidth | If not 0 (the default), overrides the output width otherwise specified in field NumberFormat.DecMinimumFieldWidth. |
numberFormat | The format definition. Defaults to null . |
this
to allow concatenated calls.
|
inline |
Overloaded version of _(long,int,NumberFormat) which provides default parameter(s).
value | The value to append. |
numberFormat | The format definition. Defaults to null . |
this
to allow concatenated calls.
|
inline |
Appends an object by invoking ToString
on it.
src | The AString compatible type to append |
this
to allow concatenated calls.
|
inline |
Append a String.
src | The String to append. |
this
to allow concatenated calls.
|
inline |
Append a region of a String.
src | The String to append. |
regionStart | The start of the region in src to append. Defaults to 0. |
regionLength | The maximum length of the region in src to append. Defaults to int.MaxValue |
this
to allow concatenated calls.
|
inline |
Append the given StringBuilder.
src | The StringBuilder to append. |
this
to allow concatenated calls.
|
inline |
Append a region of a StringBuilder.
src | The StringBuilder to append. |
regionStart | The start of the region in src to append. |
regionLength | The maximum length of the region in src to append. Defaults to int.MaxValue. |
this
to allow concatenated calls.
|
inline |
Format and append an unsigned 32-Bit integer value.
Parameter numberFormat defaults to null
, which denotes this method to use the static singleton found in NumberFormat.Computational. To generate output better readable for humans, provide NumberFormat.Global, or a customized object of that type.
See NumberFormat for more information on formatting options.
value | The value to append. |
overrideWidth | If not 0 (the default), overrides the output width otherwise specified in field NumberFormat.DecMinimumFieldWidth. |
numberFormat | The format definition. Defaults to null . |
this
to allow concatenated calls.
|
inline |
Overloaded version of _(uint,int,NumberFormat) which provides default parameter(s).
value | The value to append. |
numberFormat | The format definition. Defaults to null . |
this
to allow concatenated calls.
|
inline |
Format and append an unsigned 64-Bit integer value.
Parameter numberFormat defaults to null
, which denotes this method to use the static singleton found in NumberFormat.Computational. To generate output better readable for humans, provide NumberFormat.Global, or a customized object of that type.
See NumberFormat for more information on formatting options.
value | The value to append. |
overrideWidth | If not 0 (the default), overrides the output width otherwise specified in field NumberFormat.DecMinimumFieldWidth. |
numberFormat | The format definition. Defaults to null . |
this
to allow concatenated calls.
|
inline |
Overloaded version of _(ulong,int,NumberFormat) which provides default parameter(s).
value | The value to append. |
numberFormat | The format definition. Defaults to null . |
this
to allow concatenated calls.
|
inline |
Append a unsigned 64-Bit integer value in binary format.
Parameter numberFormat defaults to null
, which denotes this method to use the static singleton found in NumberFormat.Computational. To generate output better readable for humans, provide NumberFormat.Global, or a customized object of that type.
See NumberFormat for more information on formatting options.
value | The value to append. |
overrideWidth | If not 0 (the default), overrides the output width otherwise specified in field NumberFormat.BinFieldWidth. |
numberFormat | The format definition. Defaults to null . |
this
to allow concatenated calls.
|
inline |
Overloaded version of _Bin(ulong,int,NumberFormat) which provides default parameter(s).
value | The value to append. |
numberFormat | The format definition. Defaults to null . |
this
to allow concatenated calls.
|
inline |
Append a unsigned 64-Bit integer value in hexadecimal format.
Parameter numberFormat defaults to null
, which denotes this method to use the static singleton found in NumberFormat.Computational. To generate output better readable for humans, provide NumberFormat.Global, or a customized object of that type.
See NumberFormat for more information on formatting options.
value | The value to append. |
overrideWidth | If not 0 (the default), overrides the output width otherwise specified in field NumberFormat.HexFieldWidth. |
numberFormat | The format definition. Defaults to null . |
this
to allow concatenated calls.
|
inline |
Overloaded version of _Hex(ulong,int,NumberFormat) which provides default parameter(s).
value | The value to append. |
numberFormat | The format definition. Defaults to null . |
this
to allow concatenated calls. Append the given AString.
src | The AString to append. |
this
to allow concatenated calls. Append a region of an AString.
src | The AString to append. |
regionStart | The start of the region in src to append. |
regionLength | The maximum length of the region in src to append. |
this
to allow concatenated calls.
|
inline |
Appends a region of a character array.
src | The character array containing the region to append. |
regionStart | The start of the region in src to append. |
regionLength | The length of the region in src to append. |
this
to allow concatenated calls.
|
inline |
Appends an object by invoking ToString
on it.
src | The AString compatible type to append |
this
to allow concatenated calls.
|
inline |
Append a String.
src | The String to append. |
this
to allow concatenated calls.
|
inline |
Append a region of a String.
src | The String to append. |
regionStart | The start of the region in src to append. |
regionLength | The maximum length of the region in src to append. |
this
to allow concatenated calls. Append a Substring.
src | The source Substring. |
this
to allow concatenated calls.
|
inline |
Append a unsigned 64-Bit integer value in octal format.
Parameter numberFormat defaults to null
, which denotes this method to use the static singleton found in NumberFormat.Computational. To generate output better readable for humans, provide NumberFormat.Global, or a customized object of that type.
See NumberFormat for more information on formatting options.
value | The value to append. |
overrideWidth | If not 0 (the default), overrides the output width otherwise specified in field NumberFormat.OctFieldWidth. |
numberFormat | The format definition. Defaults to null . |
this
to allow concatenated calls.
|
inline |
Overloaded version of _Oct(ulong,int,NumberFormat) which provides default parameter(s).
value | The value to append. |
numberFormat | The format definition. Defaults to null . |
this
to allow concatenated calls.
|
inline |
The internal buffer character array. This may, but should not be accessed directly. In case of external modifications be sure to adjust the length of this AString using SetLength.
|
inline |
Returns the current size of the internal buffer.
|
inline |
Retrieves the character at the given index. A range check is performed. If this fails, '\0' is returned.
idx | The index of the character to read. |
|
inline |
Retrieves the character at the given index.
idx | The index of the character to read. |
|
inline |
Retrieve the last character. In case of an empty string, '\0' is returned.
|
inline |
Retrieve the first character.
|
inline |
Retrieve the first character. In case of an empty string, '\0' is returned.
|
inline |
Retrieve the first character.
|
inline |
|
inline |
Compares a given region of a given string with a region of this instance. Regions that are out of bounds get adjusted and then compared.
needle | An object of type AString that is compared to this. |
sensitivity | Case sensitivity of the comparison. Optional and defaults to Case.Sensitive. |
needleRegionStart | The start of the substring within the given string that is to be compared to this. Defaults to 0. |
needleRegionLength | The length of the substring within the given string that is to be compared to this. Defaults to Integer.MAX_VALUE. |
regionStart | The start of the substring within this string that is to be compared. Defaults to 0. |
regionLength | The length of the substring within this string that is to be compared. Defaults to Integer.MAX_VALUE. |
|
inline |
Compares a given region of a given string with a region of this instance. Regions that are out of bounds get adjusted and then compared.
needle | An object of type char[] that is compared to this. |
sensitivity | Case sensitivity of the comparison. Optional and defaults to Case.Sensitive. |
needleRegionStart | The start of the substring within the given string that is to be compared to this. Defaults to 0. |
needleRegionLength | The length of the substring within the given string that is to be compared to this. Defaults to Integer.MAX_VALUE. |
regionStart | The start of the substring within this string that is to be compared. Defaults to 0. |
regionLength | The length of the substring within this string that is to be compared. Defaults to Integer.MAX_VALUE. |
|
inline |
Compares a given region of a given string with a region of this instance. Regions that are out of bounds get adjusted and then compared.
needle | An object of type String that is compared to this. |
sensitivity | Case sensitivity of the comparison. Optional and defaults to Case.Sensitive. |
needleRegionStart | The start of the substring within the given string that is to be compared to this. Defaults to 0. |
needleRegionLength | The length of the substring within the given string that is to be compared to this. Defaults to Integer.MAX_VALUE. |
regionStart | The start of the substring within this string that is to be compared. Defaults to 0. |
regionLength | The length of the substring within this string that is to be compared. Defaults to Integer.MAX_VALUE. |
|
inline |
Compares a Substring with a region of this instance. The region bounds get adjusted to fit to this AString. (If this is not wanted, external checks have to be made prior to calling this method.)
needle | An object of type char[] that is compared to this. |
sensitivity | Case sensitivity of the comparison. Optional and defaults to Case.Sensitive. |
regionStart | The start of the substring within this string that is to be compared. Defaults to 0. |
regionLength | The length of the substring within this string that is to be compared. Defaults to Integer.MAX_VALUE. |
|
inline |
Checks if a region of a char[] is located at the given position.
needle | The character array containing the needle. |
needleStart | The index of the start of the needle within the character array. |
needleLength | The length of the needle within the character array. |
pos | The position to look at. |
sensitivity | Case sensitivity of the comparison. Optional and defaults to Case.Sensitive. |
|
inline |
Checks if the given String is located at the given position.
needle | The string to search. |
pos | The position to look at. |
sensitivity | Case sensitivity of the comparison. Optional and defaults to Case.Sensitive. |
|
inline |
Cuts out a region from the Buffer. A range check is performed and the region is cut to fit to the string.
regionStart | The start of the region to delete. |
regionLength | The length of the region to delete. Defaults to int.MaxValue |
this
to allow concatenated calls.
|
inline |
Cuts out a region from the Buffer.
regionStart | The start of the region to delete. |
regionLength | The length of the region to delete. |
this
to allow concatenated calls.
|
inline |
Deletes the given number of characters from the end of the string. The given region length is checked to be between 0 and length.
regionLength | The length of the region at the end to delete. |
this
to allow concatenated calls.
|
inline |
Deletes the given number of characters from the end of the string.
regionLength | The length of the region at the end to delete. |
this
to allow concatenated calls.
|
inline |
Deletes the given number of characters from the start of the string. The given region length is checked to be between 0 and length.
regionLength | The length of the region at the start to delete. |
this
to allow concatenated calls.
|
inline |
Deletes the given number of characters from the start of the string.
regionLength | The length of the region at the start to delete. |
this
to allow concatenated calls. Checks if this AString ends with the given AString.
needle | The AString to be compared with the start of this AString. If this is null or empty, true is returned. |
sensitivity | Case sensitivity of the comparison. Optional and defaults to Case.Sensitive. |
|
inline |
Checks if this String ends with the given String.
needle | The string to be compared with the start of this AString. If this is null or empty, true is returned. |
sensitivity | Case sensitivity of the comparison. Optional and defaults to Case.Sensitive. |
Checks if this AString ends with the given Substring.
needle | The Substring to be compared with the start of this AString. If this is null or empty, true is returned. |
sensitivity | Case sensitivity of the comparison. Optional and defaults to Case.Sensitive. |
|
inline |
Ensures that the capacity of the internal buffer meets or exceeds the actual length plus the given growth value.
spaceNeeded | The desired growth of the length of the string represented by this. |
Tests and returns true, if the given AString equals to what this object represents. True is returned if both are zero length or null
.
compareString | The AString that is compared to this AString. |
sensitivity | Case sensitivity of the comparison. Optional and defaults to Case.Sensitive. |
|
inline |
Tests and returns true, if the given string-type object equals to what this object represents. True is returned if both are zero length or null
. If compiled in debug mode, an assertion is thrown if the given object is not of type String, AString, Substring or char[].
compareString | An object of string-type that is compared to this AString. |
sensitivity | Case sensitivity of the comparison. Optional and defaults to Case.Sensitive. |
|
inline |
Compares this to the given object. Given object can be AString or String.
o | The Object that this instance is compared with. |
|
inline |
Tests and returns true, if the given String equals to what this object represents. True is returned if both are zero length or null
.
compareString | The AString that is compared to this AString. |
sensitivity | Case sensitivity of the comparison. Optional and defaults to Case.Sensitive. |
Tests and returns true, if the given Substring equals to what this object represents. True is returned if both are zero length or null
.
compareString | The Substring that is compared to this AString. |
sensitivity | Case sensitivity of the comparison. Optional and defaults to Case.Sensitive. |
|
inline |
Escapes non-printable characters in the given region, or converts such escaped characters to their ASCII values.
If the new region length is needed to be known, it can be calculated as the sum of the old region length and the difference of the string before and after the operation.
escape | Switch.On escapes ascii characters (the default), Switch.Off converts escaped strings to ascii codes. |
regionStart | The start of the region to convert. |
regionLength | The length of the region to convert. |
this
to allow concatenated calls.
|
inline |
If invoked without parameters, the start of a field is marked at the current end of the string. Otherwise the end of a field is set and the contents between the field start marker and the current end of the string is aligned within the field using the given pad character. Note: To implement nested fields, the outer fields have to be set by providing the start marker by using the parameter fieldStart. Hence, only the starting points of the most inner fields can be set using this method without parameters.
size | The field size in relation to the starting index of the field, defined either by using Field() prior to this invocation or by providing the parameter fieldStart. The field gets filled with the given pad character to meet the size while the content gets aligned left, right or centered. If the content exceeds the size, then no alignment takes place. |
alignment | The alignment of the contents within the field. Defaults to Alignment.Right. Other options are Alignment.Left and Alignment.Center. |
padChar | The character used to fill the field up to its size. Defaults to ' ' (space). |
fieldStart | This parameter, if given, overwrites the start index of the field. The invocation of Field can be omitted, when this value is explicitly provided. Defaults to int.MaxValue. |
this
to allow concatenated calls.
|
inline |
Calculates the hash value using the same formula as java.lang.String.
Search the given AString in the this.
needle | The string to search. |
startIdx | The index to start the search at. Optional and defaults to 0 . |
sensitivity | If true, the compare is case insensitive. Optional and defaults to false. |
|
inline |
Search the given character in the buffer.
needle | The character to search. |
startIdx | The index to start the search at. Optional and defaults to 0 . |
|
inline |
Search the given String in this.
needle | The String to search. |
startIdx | The index to start the search at. Optional and defaults to 0 . |
sensitivity | Case sensitivity of the comparison. Optional and defaults to Case.Sensitive. |
Search the given Substring in the this.
needle | The string to search. |
startIdx | The index to start the search at. Optional and defaults to 0 . |
sensitivity | If true, the compare is case insensitive. Optional and defaults to false. |
|
inline |
Returns the index of the first character which is included, respectively not included in a given set of characters.
This method searches from left to right. For reverse search, see LastIndexOfAny.
needles | AString with characters to be searched for. |
inclusion | Denotes whether the search returns the first index that holds a value that is included or that is not excluded in the set of needle characters. |
startIdx | The index to start the search at. If the given value is less than 0, it is set to 0. If it exceeds the length of the string, the length of the string is returned. Defaults to 0. |
|
inline |
Like IndexOf but in case the character is not found, this method returns the length of this string instead of -1
. Depending on the invocation context, the choice for the right version of this method may lead to shorter and more efficient code.
needle | The character to search for. |
|
inline |
Like IndexOf but in case the character is not found, this method returns the length of this string instead of -1
. Depending on the invocation context, the choice for the right version of this method may lead to shorter and more efficient code.
needle | The character to search for. |
startIdx | The index in this to start searching the character. |
Inserts a Substring . If the position is not between 0 and the length of the target, nothing is inserted.
src | The char[] to insert characters from. |
pos | The position in this object insert the portion of src. |
this
to allow concatenated calls.
|
inline |
Inserts a portion of the given char[] at a given position. If the position is not between 0 and the length of the target, nothing is inserted.
src | The char[] to insert characters from. |
cStart | The start of the substring in src to insert. |
cLength | The length of the substring in src to insert. |
pos | The position in this object insert the portion of src. |
this
to allow concatenated calls.
|
inline |
Inserts a String at a given position. If the position is not between 0 and the length of the target, nothing is inserted.
src | The char[] to insert characters from. |
pos | The position in this object insert the portion of src. |
this
to allow concatenated calls.
|
inline |
Inserts a StringBuilder at a given position. If the position is not between 0 and the length of the target, nothing is inserted.
src | The char[] to insert characters from. |
pos | The position in this object insert the portion of src. |
this
to allow concatenated calls. Inserts a Substring at a given position. If the position is not between 0 and the length of the target, nothing is inserted.
src | The char[] to insert characters from. |
pos | The position in this object insert the portion of src. |
this
to allow concatenated calls.
|
inline |
Inserts the given character n-times at the end of this string (appends).
c | The character to append. |
qty | The quantity of characters to append. |
this
to allow concatenated calls.
|
inline |
Inserts the given character n-times at a given position. If the given position is out of range, nothing is inserted.
c | The character to insert qty times. |
qty | The quantity of characters to insert. |
pos | The index in this object where c is inserted qty times. |
this
to allow concatenated calls.
|
inline |
Returns true if the actual length equals zero.
|
inline |
Returns true if the actual length does not equal zero.
|
inline |
Returns false if no buffer space is allocated, true otherwise. This might be the case, if constructed with AString() or AString(0), by invoking SetBuffer(0) or SetNull.
|
inline |
Returns true if no buffer space is allocated, false otherwise. This might be the case, if constructed with AString() or AString(0), by invoking SetBuffer(0) or SetNull.
|
inlinestatic |
Static method to test if an arbitrary object is null
. In case of type AString or Substring null
is returned when they are nulled.
o | The object to test |
true
if given object is null or a nulled ALib string type.
|
inlinestatic |
|
inline |
Searches a character backwards starting at the end or at given start index.
needle | The character to search for. |
startIndex | The index in this to start searching the character. Defaults to CString.MaxLen. |
|
inline |
Returns the index of the first character which is included, respectively not included in a given set of characters. The search starts at the given index and goes backward. For forward search, see IndexOfAny.
needles | AString with characters to be searched for. |
inclusion | Denotes whether the search returns the first index that holds a value that is included or that is not excluded in the set of needle characters. |
startIdx | The index to start the search at. The value is cropped to be in the bounds of 0 and the length of this AString minus one. Defaults to maximum integer value. |
|
inline |
Returns the actual length of this AString. This number is smaller or equals the number returned by Capacity.
|
inline |
Appends platform specific new line character(s). ( "\\r\\n", "\\r", etc.). The new length of the string is recorded as the reference position for Tab.
this
to allow concatenated calls.
|
inline |
Reads an unsigned 64-bit integer in binary format at the given position from this AString. This is done, by invoking NumberFormat.ParseBin on the given numberFormat instance.
Parameter numberFormat defaults to null
. This denotes static singleton NumberFormat.Computational which is configured to not using - and therefore also not parsing - grouping characters.
Optional output parameter newIdx may be used to detect if parsing was successful. If not, it receives the value of startIdx, even if leading whitespaces had been read.
For more information on number conversion, see class NumberFormat. All of its interface methods have a corresponding implementation within class AString.
startIdx | The start index for parsing. Optional and defaults to 0 . | |
numberFormat | The format definition. Defaults to null . | |
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value startIdx. |
|
inline |
Overloaded version of ParseBin providing default values for omitted parameters.
startIdx | The start index for parsing. Optional and defaults to 0 . | |
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value startIdx. |
|
inline |
Overloaded version of ParseBin providing default values for omitted parameters.
startIdx | The start index for parsing. Optional and defaults to 0 . |
numberFormat | The format definition. Defaults to null . |
|
inline |
Overloaded version of ParseBin providing default values for omitted parameters.
numberFormat | The format definition. Defaults to null . |
|
inline |
Overloaded version of ParseBin providing default values for omitted parameters.
numberFormat | The format definition. Defaults to null . | |
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value 0 . |
|
inline |
Overloaded version of ParseBin providing default values for omitted parameters.
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value 0 . |
|
inline |
Reads an unsigned 64-bit integer in standard decimal format at the given position from this AString. This is done, by invoking NumberFormat.ParseDec on the given numberFormat instance.
Parameter numberFormat defaults to null
. This denotes static singleton NumberFormat.Computational which is configured to not using - and therefore also not parsing - grouping characters.
Optional output parameter newIdx may be used to detect if parsing was successful. If not, it receives the value of startIdx, even if leading whitespaces had been read.
Sign literals '-'
or '+'
are not accepted and parsing will fail. For reading signed integer values, see methods ParseInt, for floating point numbers ParseFloat.
For more information on number conversion, see class NumberFormat. All of its interface methods have a corresponding implementation within class AString.
startIdx | The start index for parsing. Optional and defaults to 0 . | |
numberFormat | The format definition. Defaults to null . | |
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value startIdx. |
|
inline |
Overloaded version of ParseDec providing default values for omitted parameters.
startIdx | The start index for parsing. Optional and defaults to 0 . | |
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value startIdx. |
|
inline |
Overloaded version of ParseDec providing default values for omitted parameters.
startIdx | The start index for parsing. Optional and defaults to 0 . |
numberFormat | The format definition. Defaults to null . |
|
inline |
Overloaded version of ParseDec providing default values for omitted parameters.
numberFormat | The format definition. Defaults to null . |
|
inline |
Overloaded version of ParseDec providing default values for omitted parameters.
numberFormat | The format definition. Defaults to null . | |
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value 0 . |
|
inline |
Overloaded version of ParseDec providing default values for omitted parameters.
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value 0 . |
|
inline |
Parses an integer value consisting of characters '0'
to '9'
from this string.
Unlike with ParseInt or ParseDec, no sign, whitespaces or group characters are accepted.
startIdx | The start index from where the integer value is tried to be parsed. Optional and defaults to 0 . | |
[out] | newIdx | Optional output variable that will point to the first character in this string after the float number that was parsed. If parsing fails, it will be set to the value of parameter startIdx. |
|
inline |
Reads a floating point number at the given position from this AString. This is done, by invoking NumberFormat.ParseFloat on the given numberFormat instance.
Parameter numberFormat defaults to null
. This denotes static singleton NumberFormat.Computational which is configured to 'international' settings (not using the locale) and therefore also not parsing grouping characters.
Optional output parameter newIdx may be used to detect if parsing was successful. If not, it receives the value of startIdx, even if leading whitespaces had been read.
For more information on parsing options for floating point numbers and number conversion in general, see class NumberFormat. All of its interface methods have a corresponding implementation within class AString.
startIdx | The start index for parsing. Optional and defaults to 0 . | |
numberFormat | The format definition. Defaults to null . | |
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value startIdx. |
|
inline |
Overloaded version of ParseFloat providing default values for omitted parameters.
startIdx | The start index for parsing. Optional and defaults to 0 . | |
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value startIdx. |
|
inline |
Overloaded version of ParseFloat providing default values for omitted parameters.
startIdx | The start index for parsing. Optional and defaults to 0 . |
numberFormat | The format definition. Defaults to null . |
|
inline |
Overloaded version of ParseFloat providing default values for omitted parameters.
numberFormat | The format definition. Defaults to null . |
|
inline |
Overloaded version of ParseFloat providing default values for omitted parameters.
numberFormat | The format definition. Defaults to null . | |
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value 0 . |
|
inline |
Overloaded version of ParseFloat providing default values for omitted parameters.
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value 0 . |
|
inline |
Reads an unsigned 64-bit integer in hexadecimal format at the given position from this AString. This is done, by invoking NumberFormat.ParseHex on the given numberFormat instance.
Parameter numberFormat defaults to null
. This denotes static singleton NumberFormat.Computational which is configured to not using - and therefore also not parsing - grouping characters.
Optional output parameter newIdx may be used to detect if parsing was successful. If not, it receives the value of startIdx, even if leading whitespaces had been read.
For more information on number conversion, see class NumberFormat. All of its interface methods have a corresponding implementation within class AString.
startIdx | The start index for parsing. Optional and defaults to 0 . | |
numberFormat | The format definition. Defaults to null . | |
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value startIdx. |
|
inline |
Overloaded version of ParseHex providing default values for omitted parameters.
startIdx | The start index for parsing. Optional and defaults to 0 . | |
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value startIdx. |
|
inline |
Overloaded version of ParseHex providing default values for omitted parameters.
startIdx | The start index for parsing. Optional and defaults to 0 . |
numberFormat | The format definition. Defaults to null . |
|
inline |
Overloaded version of ParseHex providing default values for omitted parameters.
numberFormat | The format definition. Defaults to null . |
|
inline |
Overloaded version of ParseHex providing default values for omitted parameters.
numberFormat | The format definition. Defaults to null . | |
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value 0 . |
|
inline |
Overloaded version of ParseHex providing default values for omitted parameters.
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value 0 . |
|
inline |
Parses a long integer value in decimal, binary, hexadecimal or octal format from the string by invoking method NumberFormat.ParseInt on the given numberFormat instance.
Parameter numberFormat defaults to null
. This denotes static singleton NumberFormat.Computational which is configured to not using - and therefore also not parsing - grouping characters.
Optional output parameter newIdx may be used to detect if parsing was successful. If not, it receives the value of startIdx, even if leading whitespaces had been read.
For more information on number conversion, see class NumberFormat. All of its interface methods have a corresponding implementation within class AString.
startIdx | The start index for parsing. Optional and defaults to 0 . | |
numberFormat | The format definition. Defaults to null . | |
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value startIdx. |
|
inline |
Overloaded version of ParseInt providing default values for omitted parameters.
startIdx | The start index for parsing. Optional and defaults to 0 . | |
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value startIdx. |
|
inline |
Overloaded version of ParseInt providing default values for omitted parameters.
startIdx | The start index for parsing. Optional and defaults to 0 . |
numberFormat | The format definition. Defaults to null . |
|
inline |
Overloaded version of ParseInt providing default values for omitted parameters.
numberFormat | The format definition. Defaults to null . |
|
inline |
Overloaded version of ParseInt providing default values for omitted parameters.
numberFormat | The format definition. Defaults to null . | |
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value 0 . |
|
inline |
Overloaded version of ParseInt providing default values for omitted parameters.
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value 0 . |
|
inline |
Reads an unsigned 64-bit integer in octal format at the given position from this AString. This is done, by invoking NumberFormat.ParseOct on the given numberFormat instance.
Parameter numberFormat defaults to null
. This denotes static singleton NumberFormat.Computational which is configured to not using - and therefore also not parsing - grouping characters.
Optional output parameter newIdx may be used to detect if parsing was successful. If not, it receives the value of startIdx, even if leading whitespaces had been read.
For more information on number conversion, see class NumberFormat. All of its interface methods have a corresponding implementation within class AString.
startIdx | The start index for parsing. Optional and defaults to 0 . | |
numberFormat | The format definition. Defaults to null . | |
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value startIdx. |
|
inline |
Overloaded version of ParseOct providing default values for omitted parameters.
startIdx | The start index for parsing. Optional and defaults to 0 . | |
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value startIdx. |
|
inline |
Overloaded version of ParseOct providing default values for omitted parameters.
startIdx | The start index for parsing. Optional and defaults to 0 . |
numberFormat | The format definition. Defaults to null . |
|
inline |
Overloaded version of ParseOct providing default values for omitted parameters.
numberFormat | The format definition. Defaults to null . |
|
inline |
Overloaded version of ParseOct providing default values for omitted parameters.
numberFormat | The format definition. Defaults to null . | |
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value 0 . |
|
inline |
Overloaded version of ParseOct providing default values for omitted parameters.
[out] | newIdx | Optional output variable that will point to the first character in this string after the number parsed. On failure, it will be set to the initial value 0 . |
|
inline |
Replaces a region in the string with the given character. The region is adjusted to fit into the current length. In other words, the length of this instances remains the same.
c | The character to set in the region. |
regionStart | The start of the region |
regionLength | The length of the region |
this
to allow concatenated calls. Replaces a region in this object by a given AString. If the region does not fit to this object, then nothing is done.
src | The replacement string. |
regionStart | The start of the region. |
regionLength | The length of the region. |
this
to allow concatenated calls.
|
inline |
Replaces a region in this object by a portion of a character array. If the region does not fit to this object, then nothing is done.
src | The char[] to insert characters from. |
cStart | The start of the substring in src to insert. |
cLength | The length of the substring in src to insert. |
regionStart | The start of the region. |
regionLength | The length of the region. |
this
to allow concatenated calls.
|
inline |
Replaces a region in this object by a given string. If the region does not fit to this object, then nothing is done.
src | The replacement string. |
regionStart | The start of the region. |
regionLength | The length of the region. |
this
to allow concatenated calls. Replaces a region in this object by a given Substring. If the region does not fit to this object, then nothing is done.
src | The replacement string. |
regionStart | The start of the region. |
regionLength | The length of the region. |
this
to allow concatenated calls.
|
inlineprotected |
Protected method that resizes a region into the Buffer. The region contents is undefined.
regionStart | The start of the region to insert. If this is out of the string bounds (hence less than 0 or greater then Length), nothing is done. |
regionLength | The current length of the region. |
newLength | The desired length of the region. |
true
, if the parameters were OK and the region was resized, false
otherwise.
|
inline |
Replace one or more occurrences of a string by another string. Returns the number of replacements.
searchStr | The String to be replaced. |
newStr | The replacement string. |
startIdx | The index where the search starts. Optional and defaults to 0. |
maxReplacements | The maximum number of replacements to perform. Optional and defaults to int.MaxValue . |
sensitivity | Case sensitivity of the comparison. Optional and defaults to Case.Sensitive. |
|
inline |
Replaces one or more occurrences of one character by another character.
needle | The terminatable string to be replaced. |
replacement | The replacement string (does not need to be zero terminatable). |
startIdx | The index where the search starts. Optional and defaults 0. |
|
inline |
Replace one or more occurrences of a string by another string. Returns the number of replacements.
searchStr | The String to be replaced. |
newStr | The replacement string. |
startIdx | The index where the search starts. Optional and defaults to 0. |
maxReplacements | The maximum number of replacements to perform. Optional and defaults to int.MaxValue . |
sensitivity | Case sensitivity of the comparison. Optional and defaults to Case.Sensitive. |
|
inline |
Replace one or more occurrences of a string by another string.
searchStr | The String to be replaced. |
newStr | The replacement string. |
startIdx | The index where the search starts. Optional and defaults to 0. |
maxReplacements | The maximum number of replacements to perform. Optional and defaults to int.MaxValue . |
sensitivity | Case sensitivity of the comparison. Optional and defaults to Case.Sensitive. |
this
to allow concatenated calls.
|
inline |
Replace one or more occurrences of a string by another string.
searchStr | The String to be replaced. |
newStr | The replacement string. |
startIdx | The index where the search starts. Optional and defaults to 0. |
maxReplacements | The maximum number of replacements to perform. Optional and defaults to int.MaxValue . |
sensitivity | Case sensitivity of the comparison. Optional and defaults to Case.Sensitive. |
this
to allow concatenated calls.
|
inline |
Resizes the internal buffer to meet exactly the given size.
The following rules apply:
newCapacity | The new capacity of the internal buffer. |
|
inline |
Sets the character at the given index. A range check is performed. If this fails, nothing is done.
idx | The index of the character to write. |
c | The character to write. |
|
inline |
Sets the character at the given index.
idx | The index of the character to write. |
c | The character to write. |
|
inline |
Set the actual length of the stored string. The string can only be shortened with this method. To change the internal allocation size, see SetBuffer.
newLength | The new length of the AString. Must be smaller than the current length. |
|
inline |
Set the actual length of the stored string. The string can only be shortened with this method.
newLength | The new length of the AString. Must be between 0 and the current length. |
|
inline |
|
inline |
Checks if this AString starts with the given String.
needle | The String to search. If s is null or empty, false is returned. |
sensitivity | Case sensitivity of the comparison. Optional and defaults to Case.Sensitive. |
|
inline |
Go to the next tab stop by filling in pad characters repeatedly. The tab position is relative the start of the current line within the string (if no calls to NewLine where performed, yet, this is always the start of the string).
tabSize | The tab positions are multiples of this parameter. |
minPad | (Optional) The minimum pad characters to add. Defaults to 1. |
tabChar | (Optional) The character to insert to reach the tab position. Defaults to ' ' (space). |
this
to allow concatenated calls.
|
inline |
Converts all or a region of characters in the Buffer to lower case.
regionStart | Start of the region to be converted. Defaults to 0 |
regionLength | Length of the region to be converted. Defaults to int.MaxValue. |
this
to allow concatenated calls.
|
inline |
Creates a String containing a copy of the contents of this AString.
|
inline |
Creates a String containing a copy of a region of the contents of this AString.
regionStart | The start index of the region in this to create the string from. |
regionLength | The maximum length of the region to create the string from. Defaults to int.MaxValue. |
|
inline |
Copies the contents of this AString into the given StringBuilder.
result | A result string to copy the contents of this AString into. |
appendMode | Optional: If true, any contents in the result is preserved. Otherwise such content gets replaced (default). |
|
inline |
Copies a region of the contents of this AString into the given StringBuilder.
result | A result string to copy the specified region into. |
regionStart | The start index of the region to be copied. |
regionLength | The maximum length of the region to be copied. Defaults to int.MaxValue. |
appendMode | If true, any contents in the result is preserved. Otherwise such content gets replaced. Defaults to false. |
|
inline |
Converts all or a region of characters in the Buffer to upper case.
regionStart | Start of the region to be converted. Defaults to 0 |
regionLength | Length of the region to be converted. Defaults to int.MaxValue. |
this
to allow concatenated calls.
|
inline |
All characters defined in given set are removed at the beginning and at the end of this AString.
See method TrimAt to remove whitespaces anywhere in the string.
trimChars | The set of characters to be omitted. Defaults to null which causes this method to use CString.DefaultWhitespaces. |
this
to allow concatenated calls.
|
inline |
All characters defined in given set at, left of and right of the given index are removed from the string.
The method returns index of the first character of those characters that were behind the trimmed region. With legal index given, this value can only be smaller or equal to index. If index is out of bounds, the length of the string is returned.
idx | The index to perform the trim operation at. Has to be between zero and Length() -1. |
trimChars | Pointer to a zero terminated set of characters to be omitted. Defaults to CString.DefaultWhitespaces. |
|
inline |
All characters defined in given set are removed at the end of this string.
trimChars | The set of characters to be omitted. Defaults to CString.DefaultWhitespaces. |
this
to allow concatenated calls.
|
inline |
All characters defined in given set are removed at the beginning of this string.
trimChars | The set of characters to be omitted. Defaults to CString.DefaultWhitespaces. |
this
to allow concatenated calls.
|
protected |
The Buffer array. This may but should not be accessed directly. In case of external modifications the field hash has to be set to dirty (0).
|
protected |
The hash value. Has to be set dirty (0) whenever String is changed from outside!.
|
protected |
The actual length of the string stored in the Buffer. In case of external modifications the field hash has to be set to dirty (0).
|
getset |
The C# indexer allows array type access. This is implemented here including a range check. If this fails, the get part will return '\0', the set part will do nothing.
idx | The index of the character to read. |