Class TokenizerHelper
- Namespace
- HelixToolkit
- Assembly
- HelixToolkit.dll
public sealed class TokenizerHelper
- Inheritance
-
TokenizerHelper
- Inherited Members
Constructors
TokenizerHelper(string?, char, char)
Initialize the TokenizerHelper with the string to tokenize, the char which represents quotes and the list separator.
public TokenizerHelper(string? str, char quoteChar, char separator)
Parameters
strstringThe string to tokenize.
quoteCharcharThe quote char.
separatorcharThe list separator.
TokenizerHelper(string?, IFormatProvider)
Constructor for TokenizerHelper which accepts an IFormatProvider. If the IFormatProvider is null, we use the thread's IFormatProvider info. We will use ',' as the list separator, unless it's the same as the decimal separator. If it is, then we can't determine if, say, "23,5" is one number or two. In this case, we will use ";" as the separator.
public TokenizerHelper(string? str, IFormatProvider formatProvider)
Parameters
strstringThe string which will be tokenized.
formatProviderIFormatProviderThe IFormatProvider which controls this tokenization.
Properties
FoundSeparator
public bool FoundSeparator { get; }
Property Value
Methods
GetCurrentToken()
public ReadOnlySpan<char> GetCurrentToken()
Returns
GetNumericListSeparator(IFormatProvider)
public static char GetNumericListSeparator(IFormatProvider provider)
Parameters
providerIFormatProvider
Returns
LastTokenRequired()
Throws an exception if there is any non-whitespace left un-parsed.
public void LastTokenRequired()
NextToken()
Advances to the NextToken
public bool NextToken()
Returns
- bool
true if next token was found, false if at end of string
NextToken(bool)
Advances to the NextToken
public bool NextToken(bool allowQuotedToken)
Parameters
allowQuotedTokenbool
Returns
- bool
true if next token was found, false if at end of string
NextToken(bool, char)
Advances to the NextToken. A separator character can be specified which overrides the one previously set.
public bool NextToken(bool allowQuotedToken, char separator)
Parameters
Returns
- bool
true if next token was found, false if at end of string
NextTokenRequired()
Advances to the NextToken, throwing an exception if not present
public ReadOnlySpan<char> NextTokenRequired()
Returns
- ReadOnlySpan<char>
The next token found
NextTokenRequired(bool)
Advances to the NextToken, throwing an exception if not present
public ReadOnlySpan<char> NextTokenRequired(bool allowQuotedToken)
Parameters
allowQuotedTokenbool
Returns
- ReadOnlySpan<char>
The next token found