Table of Contents

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

str string

The string to tokenize.

quoteChar char

The quote char.

separator char

The 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

str string

The string which will be tokenized.

formatProvider IFormatProvider

The IFormatProvider which controls this tokenization.

Properties

FoundSeparator

public bool FoundSeparator { get; }

Property Value

bool

Methods

GetCurrentToken()

public ReadOnlySpan<char> GetCurrentToken()

Returns

ReadOnlySpan<char>

GetNumericListSeparator(IFormatProvider)

public static char GetNumericListSeparator(IFormatProvider provider)

Parameters

provider IFormatProvider

Returns

char

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

allowQuotedToken bool

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

allowQuotedToken bool
separator char

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

allowQuotedToken bool

Returns

ReadOnlySpan<char>

The next token found