C# Класс MONI.Util.StringParserHelper

Показать файл Открыть проект

Открытые методы

Метод Описание
SplitOnFirst ( this s, string separator ) : string>.Tuple
SplitOnLast ( this s, string separator ) : string>.Tuple
SplitWithIgnoreRegions ( this s, char separators ) : IEnumerable
Token ( this s, string separator, int token ) : string

small convenience method to access token (parts) of a string "la-li-lu".Token('-', 1) == "la" "la-li-lu".Token('-', 4) == string.empty "la-li-lu".Token('-', 0) == "la-li-lu" "la-li-lu".Token('-', -1) == "lu" String.empty.Token('-', x) == string.empty // for all x the index is not nullbased!! so the first token is 1 and the last token is -1

Token ( this s, string separator, int token, string fallback ) : string

small convenience method to access token (parts) of a string "la-li-lu".Token('-', 1) == "la" "la-li-lu".Token('-', 4) == fallback "la-li-lu".Token('-', 0) == "la-li-lu" "la-li-lu".Token('-', -1) == "lu" String.empty.Token('-', x) == fallback // for all x the index is not nullbased!! so the first token is 1 and the last token is -1

TokenReturnInputIfFail ( this s, string separator, int token ) : string

small convenience method to access token (parts) of a string "la-li-lu".Token('-', 1) == "la" "la-li-lu".Token('-', 4) == input "la-li-lu".Token('-', 0) == "la-li-lu" "la-li-lu".Token('-', -1) == "lu" String.empty.Token('-', x) == input // for all x the index is not nullbased!! so the first token is 1 and the last token is -1

Описание методов

SplitOnFirst() публичный статический Метод

public static SplitOnFirst ( this s, string separator ) : string>.Tuple
s this
separator string
Результат string>.Tuple

SplitOnLast() публичный статический Метод

public static SplitOnLast ( this s, string separator ) : string>.Tuple
s this
separator string
Результат string>.Tuple

SplitWithIgnoreRegions() публичный статический Метод

public static SplitWithIgnoreRegions ( this s, char separators ) : IEnumerable
s this
separators char
Результат IEnumerable

Token() публичный статический Метод

small convenience method to access token (parts) of a string "la-li-lu".Token('-', 1) == "la" "la-li-lu".Token('-', 4) == string.empty "la-li-lu".Token('-', 0) == "la-li-lu" "la-li-lu".Token('-', -1) == "lu" String.empty.Token('-', x) == string.empty // for all x the index is not nullbased!! so the first token is 1 and the last token is -1
public static Token ( this s, string separator, int token ) : string
s this the given string to split
separator string the separator the split is done with
token int index of token to use, this is 1-based
Результат string

Token() публичный статический Метод

small convenience method to access token (parts) of a string "la-li-lu".Token('-', 1) == "la" "la-li-lu".Token('-', 4) == fallback "la-li-lu".Token('-', 0) == "la-li-lu" "la-li-lu".Token('-', -1) == "lu" String.empty.Token('-', x) == fallback // for all x the index is not nullbased!! so the first token is 1 and the last token is -1
public static Token ( this s, string separator, int token, string fallback ) : string
s this the given string to split
separator string the separator the split is done with
token int index of token to use, this is 1-based
fallback string what will be returned if separator is not found
Результат string

TokenReturnInputIfFail() публичный статический Метод

small convenience method to access token (parts) of a string "la-li-lu".Token('-', 1) == "la" "la-li-lu".Token('-', 4) == input "la-li-lu".Token('-', 0) == "la-li-lu" "la-li-lu".Token('-', -1) == "lu" String.empty.Token('-', x) == input // for all x the index is not nullbased!! so the first token is 1 and the last token is -1
public static TokenReturnInputIfFail ( this s, string separator, int token ) : string
s this the given string to split
separator string the separator the split is done with
token int index of token to use, this is 1-based
Результат string