This class is used for defining a region (sub-string) on an existing character array which is provided. This class will not manipulate the underlying data. In particular, there is no terminating zero written into the data.
The represented region is defined by the two fields Start and End. The fields are public accessible. In general, while working with a Substring, the size of it should shrink, e.g. by trimming but should not grow. However, if the code using this class is "sure" that enlarging the region does violate the bounds of the buffer, fields Start and End might be modified from outside.
If created or set using a reference of class AString, the buffer of AString is not copied. This allows efficient operations on sub-strings of class AString. However, the source string must not be changed (or only in a controlled way) during the use the Substring instance.
Objects of this class can be reused by freshly initializing them using one of the overloaded Set methods.
Public Fields | |
char[] | Buf |
int | End |
int | Start |
Public Methods | |
Constructors | |
Substring () | |
Substring (String src, int start=0, int length=-1) | |
Substring (Substring src, int start=0, int length=-1) | |
Substring (AString src, int start=0, int length=-1) | |
Substring (char[] cstring, int start=0, int length=-1) | |
Set Data | |
Substring | Set (Substring src, int regionStart=0, int regionLength=-1) |
Substring | Set (String src, int start=0, int length=-1) |
Substring | Set (AString src, int start, int length) |
Substring | Set (AString src, int start) |
Substring | Set (AString src) |
Substring | Set (char[] src, int start=0, int length=-1) |
State and Character Access | |
int | Length () |
void | SetNull () |
void | Clear () |
bool | IsNull () |
bool | IsNotNull () |
bool | IsEmpty () |
bool | IsNotEmpty () |
char | CharAtStart () |
char | CharAt (int n) |
char | CharAtEnd () |
char | CharAtEnd (int n) |
Consume | |
char | ConsumeChar () |
char | ConsumeCharFromEnd () |
bool | ConsumeChar (char consumable, Case sensitivity=Case.Sensitive, Whitespaces trimBeforeConsume=Whitespaces.Keep) |
bool | ConsumeCharFromEnd (char consumable, Case sensitivity=Case.Sensitive, Whitespaces trimBeforeConsume=Whitespaces.Keep) |
int | ConsumeChars (int regionLength, Substring target=null) |
int | ConsumeCharsFromEnd (int regionLength, Substring target=null) |
int | ConsumeToken (Substring target, char separator=',') |
bool | ConsumeString (String consumable, Case sensitivity=Case.Sensitive, Whitespaces trimBeforeConsume=Whitespaces.Keep) |
bool | ConsumeString (AString consumable, Case sensitivity=Case.Sensitive, Whitespaces trimBeforeConsume=Whitespaces.Keep) |
bool | ConsumeString (Substring consumable, Case sensitivity=Case.Sensitive, Whitespaces trimBeforeConsume=Whitespaces.Keep) |
bool | ConsumeStringFromEnd (String consumable, Case sensitivity=Case.Sensitive, Whitespaces trimBeforeConsume=Whitespaces.Keep) |
bool | ConsumeStringFromEnd (AString consumable, Case sensitivity=Case.Sensitive, Whitespaces trimBeforeConsume=Whitespaces.Keep) |
bool | ConsumeStringFromEnd (Substring consumable, Case sensitivity=Case.Sensitive, Whitespaces trimBeforeConsume=Whitespaces.Keep) |
int | ConsumePartOf (String consumable, int minChars=1, lang.Case sensitivity=lang.Case.Ignore, lang.Whitespaces trimBeforeConsume=lang.Whitespaces.Keep) |
Substring | ConsumeField (char startChar, char endChar, Substring target, lang.Whitespaces trimBeforeConsume=lang.Whitespaces.Keep) |
bool | ConsumeDecDigits (out ulong result) |
bool | ConsumeDecDigits (out int result) |
bool | ConsumeInt (out long result, NumberFormat numberFormat=null) |
bool | ConsumeInt (out int result, NumberFormat numberFormat=null) |
bool | ConsumeDec (out ulong result, NumberFormat numberFormat=null) |
bool | ConsumeDec (out uint result, NumberFormat numberFormat=null) |
bool | ConsumeBin (out ulong result, NumberFormat numberFormat=null) |
bool | ConsumeBin (out uint result, NumberFormat numberFormat=null) |
bool | ConsumeHex (out ulong result, NumberFormat numberFormat=null) |
bool | ConsumeHex (out uint result, NumberFormat numberFormat=null) |
bool | ConsumeOct (out ulong result, NumberFormat numberFormat=null) |
bool | ConsumeOct (out uint result, NumberFormat numberFormat=null) |
bool | ConsumeFloat (out double result, NumberFormat numberFormat=null) |
Substring | Split (int position, Substring target, int separatorWidth=0) |
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 | IndexOfFirstDifference (String needle, Case sensitivity=Case.Sensitive, int startIdx=0) |
int | IndexOfAny (char[] needles, Inclusion inclusion, int startIdx=0) |
int | LastIndexOfAny (char[] needles, Inclusion inclusion, int startIdx=int.MaxValue) |
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) |
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) |
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) |
Trim | |
Substring | TrimStart (char[] whiteSpaces) |
Substring | TrimStart () |
Substring | TrimEnd (char[] whiteSpaces) |
Substring | TrimEnd () |
Substring | Trim (char[] whiteSpaces) |
Substring | Trim () |
Conversion | |
void | CopyTo (AString target, bool append=false) |
override String | ToString () |
String | ToString (int regionStart, int regionLength=int.MaxValue) |
C# std library interface implementation | |
override int | GetHashCode () |
Protected Fields | |
int | hash =0 |
|
inline |
Empty Constructor. Sets this sub-string to 'null'
|
inline |
Constructs the Substring on the given String. The String's data is copied. To avoid memory allocations (for copy operation) it is preferred to use an AString as input wherever appropriate.
src | The string we work with. |
start | The start index of the substring within the given String. |
length | The number of characters to include from the given String. If negative, length of the provided src is used. Defaults to -1. |
|
inline |
Constructs the sub-string to work on the provided character array.
cstring | The character array to work on. |
start | The start index of the substring within the given character array. If negative, the character array is |
length | The number of characters to include from the given character array. If negative, the character array is assumed to be zero terminated and its length is evaluated using the strlen() function from the standard C library. Defaults to -1. |
|
inline |
Retrieve the n-th character in the substring.
n | The offset of the requested character. |
|
inline |
Retrieve the last character in the substring.
|
inline |
Retrieve the n-th character in the substring, counted from the back.
n | The offset of the requested character. Attention: n is subtracted from the end. In other words, positive values peek towards the start of the region. |
|
inline |
Retrieve the first character in the substring.
|
inline |
Sets the represented region to zero length by setting end to start -1.
|
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 |
Overloaded version of ConsumeBin(out ulong,NumberFormat =) accepting an uint value.
[out] | result | A reference to the result value. |
numberFormat | Defines the input format. Optional and defaults to null . |
true
if a number was consumed, false
otherwise.
|
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.
For more information on number conversion, see class NumberFormat.
[out] | result | A reference to the result value. |
numberFormat | Defines the input format. Optional and defaults to null . |
true
if a number was consumed, false
otherwise.
|
inline |
Retrieve and remove the first character in the substring.
|
inline |
Checks if this object starts with the given character consumable. If it does, this character is cut from this object.
consumable | The consumable character |
sensitivity | The sensitivity of the comparison. |
trimBeforeConsume | Determines if the string should be (left-) trimmed before the consume operation. Defaults to Whitespaces.Keep. |
true
, if this object was starting with consumable and consequently the string was cut by one.
|
inline |
Retrieve and remove the last character in the substring.
|
inline |
Checks if this object ends with the given character consumable. If it does, this character is cut from the end of object.
consumable | The consumable character |
sensitivity | The sensitivity of the comparison. |
trimBeforeConsume | Determines if the string should be (right-) trimmed before the consume operation. Defaults to Whitespaces.Keep. |
true
, if this object was starting with consumable and consequently the string was cut by one.
|
inline |
Cuts the given number of characters from the beginning of the Substring and optionally places the portion that was cut in parameter target (if provided).
Parameter regionLength is checked to be between 0 and length. If negative, nothing is cut and target is set empty. If regionLength is greater than this objects' length, all contents is 'moved' to target.
regionLength | The length of the region at the start to delete. |
target | An optional target Substring that receives the portion that is cut from this object. Defaults to null. |
|
inline |
Cuts the given number of characters from the end of the Substring and optionally places the portion that was cut in parameter target (if provided).
Parameter regionLength is checked to be between 0 and length. If negative, nothing is cut and target is set empty. If regionLength is greater than this objects' length, all contents is 'moved' to target.
regionLength | The length of the region at the start to delete. |
target | An optional target Substring that receives the portion that is cut from this object. Defaults to null. |
|
inline |
Overloaded version of ConsumeDec(out ulong,NumberFormat =) accepting an uint value.
[out] | result | A reference to the result value. |
numberFormat | Defines the input format. Optional and defaults to null . |
true
if a number was consumed, false
otherwise.
|
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.
Sign literals '-'
or '+'
are not accepted and parsing will fail. For reading signed integer values, see methods ConsumeInt, for floating point numbers ConsumeFloat.
For more information on number conversion, see class NumberFormat.
[out] | result | A reference to the result value. |
numberFormat | Defines the input format. Optional and defaults to null . |
true
if a number was consumed, false
otherwise.
|
inline |
Overloaded version of ConsumeDecDigits(out ulong) accepting an int value.
[out] | result | A reference to the result value. |
true
if a number was consumed, false
otherwise.
|
inline |
Consumes all characters '0'
to '9'
at the start of this object and stores the number value they represent in result.
Unlike with ConsumeInt or ConsumeDec, no sign, whitespaces or group characters are consumed.
[out] | result | A reference to the result value. |
true
if a number was consumed, false
otherwise.
|
inline |
Consumes a field from the beginning of this substring, which is surrounded by given start end end character identifiers. If both are the same, e.g. '"'
, then the first occurrence of the end character is used. If they are not the same, e.g. '<'
and '>'
, then repeated start characters are counted and consumption only ends when a corresponding amount of end characters has been found.
startChar | The start character of the field to consume. |
endChar | The end character of the field to consume. |
target | The target string to place the field in. |
trimBeforeConsume | Determines if the string should be (left-) trimmed before the consume operation. Defaults to Whitespaces.Keep. |
|
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.
For more information on parsing options for floating point numbers and number conversion in general, see class NumberFormat.
[out] | result | A reference to the result value. |
numberFormat | Defines the input format. Optional and defaults to null . |
true
if a number was consumed, false
otherwise.
|
inline |
Overloaded version of ConsumeHex(out ulong,NumberFormat =) accepting an uint value.
[out] | result | A reference to the result value. |
numberFormat | Defines the input format. Optional and defaults to null . |
true
if a number was consumed, false
otherwise.
|
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.
For more information on number conversion, see class NumberFormat.
[out] | result | A reference to the result value. |
numberFormat | Defines the input format. Optional and defaults to null . |
true
if a number was consumed, false
otherwise.
|
inline |
Overloaded version of ConsumeInt(out long,NumberFormat =) accepting an int value.
[out] | result | A reference to the result value. |
numberFormat | Defines the input format. Optional and defaults to null . |
true
if a number was consumed, false
otherwise.
|
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.
For more information on number conversion, see class NumberFormat.
[out] | result | A reference to the result value. |
numberFormat | Defines the input format. Optional and defaults to null . |
true
if a number was consumed, false
otherwise.
|
inline |
Overloaded version of ConsumeOct(out ulong,NumberFormat =) accepting an uint value.
[out] | result | A reference to the result value. |
numberFormat | Defines the input format. Optional and defaults to null . |
true
if a number was consumed, false
otherwise.
|
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.
For more information on number conversion, see class NumberFormat.
[out] | result | A reference to the result value. |
numberFormat | Defines the input format. Optional and defaults to null . |
true
if a number was consumed, false
otherwise.
|
inline |
Consumes a minimum of minChars of string consumable
from the start of this substring. If the minimum characters could not be found, nothing is consumed, otherwise as much as possible.
This method is useful for example to read commands from a string that may be abbreviated.
consumable | The consumable string. |
minChars | The minimum amount of characters to consume. If 0 or negative, the length of consumable is chosen. Optional and defaults to 1 . |
sensitivity | The sensitivity of the comparison. Defaults to Case.Ignore. |
trimBeforeConsume | Determines if the string should be (left-) trimmed before the first character consume operation. Defaults to Whitespaces.Keep. |
|
inline |
Checks if this object starts with the given string consumable. If it does, this string is cut from this object.
consumable | The consumable string |
sensitivity | The sensitivity of the comparison. |
trimBeforeConsume | Determines if the string should be (left-) trimmed before the consume operation. Defaults to Whitespaces.Keep. |
true
, if this object was starting with consumable and consequently the string was cut.
|
inline |
Checks if this object starts with the given string consumable. If it does, this string is cut from this object.
consumable | The consumable string |
sensitivity | The sensitivity of the comparison. |
trimBeforeConsume | Determines if the string should be (left-) trimmed before the consume operation. Defaults to Whitespaces.Keep. |
true
, if this object was starting with consumable and consequently the string was cut.
|
inline |
Checks if this object starts with the given string consumable. If it does, this string is cut from this object.
consumable | The consumable string |
sensitivity | The sensitivity of the comparison. |
trimBeforeConsume | Determines if the string should be (left-) trimmed before the consume operation. Defaults to Whitespaces.Keep. |
true
, if this object was starting with consumable and consequently the string was cut.
|
inline |
Checks if this object ends with the given string consumable. If it does, this string is cut from the end of object.
consumable | The consumable string |
sensitivity | The sensitivity of the comparison. |
trimBeforeConsume | Determines if the string should be (right-) trimmed before the consume operation. Defaults to Whitespaces.Keep. |
true
, if this object was starting with consumable and consequently the string was cut.
|
inline |
Checks if this object ends with the given string consumable. If it does, this string is cut from the end of object.
consumable | The consumable string |
sensitivity | The sensitivity of the comparison. |
trimBeforeConsume | Determines if the string should be (right-) trimmed before the consume operation. Defaults to Whitespaces.Keep. |
true
, if this object was starting with consumable and consequently the string was cut.
|
inline |
Checks if this object ends with the given string consumable. If it does, this string is cut from the end of object.
consumable | The consumable string |
sensitivity | The sensitivity of the comparison. |
trimBeforeConsume | Determines if the string should be (right-) trimmed before the consume operation. Defaults to Whitespaces.Keep. |
true
, if this object was starting with consumable and consequently the string was cut.
|
inline |
Searches separator and cuts the beginning of this string, including the separator. What was consumed is returned, excluding the separator.
If the separator is not found, all of this string is consumed and returned.
target | The target substring. |
separator | The separator to search. Defaults to ',' . |
|
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 |
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. |
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 |
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 |
Searches the given character.
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 |
Searches the first difference with given string. If this string starts with needle, then the length of needle is returned.
needle | The String to search. |
sensitivity | Case sensitivity of the comparison. Optional and defaults to Case.Sensitive. |
startIdx | The index to start the search at. Optional and 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. |
|
inline |
Checks if represented region has a length of zero.
|
inline |
Checks if the represented region has a length of more than zero.
|
inline |
|
inline |
|
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 |
Sets the substring to represent the given AString.
src | The AString to work on. |
this
to allow concatenated calls. Sets the substring to represent a region of the given AString.
src | The AString to work on. |
start | The start index of the substring within the given AString. |
length | The number of characters to include from the given AString. If negative, length of the provided src is used. |
this
to allow concatenated calls.
|
inline |
Resets the sub-string to work on the provided character array.
src | The character array to work on. |
start | The start index of the substring within the given character array. |
length | The number of characters to include from the given character array. If negative, length of the provided src is used. Defaults to -1. |
this
to allow concatenated calls.
|
inline |
Sets the substring to represent a region of the given String.
src | The string we work with. |
start | The start index of the substring within the given String. |
length | The number of characters to include from the given String.. If negative, length of the provided src is used. Defaults to -1. |
this
to allow concatenated calls. Sets the substring to represent a region of the given Substring.
src | The substring to copy from. |
regionStart | The start of the region within src. Defaults to 0. |
regionLength | The length of the region within src. If negative, length of the provided src is used. Defaults to -1. |
this
to allow concatenated calls.
|
inline |
Sets this to null state and in addition to empty state.
Splits this substring into two parts. What remains in this object is the region from 0 to position. target receives the rest. If separatorWidth is given, this is subtracted from the front of target.
position | The index where this object is split. |
target | The target substring to receive the right part of the string. |
separatorWidth | This does not change what remains in this object, but defines the number of characters that are cut from the front of the target. Defaults to 0. |
this
to allow concatenated calls.
|
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 |
Overrides Object.ToString(). Copies the string region represented by this object into a new string.
|
inline |
Creates a String containing a copy of a region of the this Substring.
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 |
Invokes Trim(char[] whiteSpaces) providing default parameter CString.DefaultWhitespaces.
this
to allow concatenated calls.
|
inline |
Invokes TrimStart and TrimEnd .
whiteSpaces | The characters used for trimming. Defaults to CString.DefaultWhitespaces. |
this
to allow concatenated calls.
|
inline |
Invokes TrimEnd(char[] whiteSpaces) providing default parameter CString.DefaultWhitespaces.
this
to allow concatenated calls.
|
inline |
Moves the start marker to the first character not found in parameter whiteSpaces.
whiteSpaces | The characters used for trimming. Defaults to CString.DefaultWhitespaces. |
this
to allow concatenated calls.
|
inline |
Invokes TrimStart(char[] whiteSpaces) providing default parameter CString.DefaultWhitespaces.
this
to allow concatenated calls.
|
inline |
Moves the start marker to the first character not found in parameter whiteSpaces.
whiteSpaces | The characters used for trimming. Defaults to CString.DefaultWhitespaces. |
this
to allow concatenated calls. char [] Buf |
The character array we work on.
int End |
End marker within buf (points to the last character)
|
protected |
The hash value. Has to be set dirty (0) whenever String is changed from outside!.
int Start |
Start marker within buf