C# Class MONI.Util.StringParserHelper

Exibir arquivo Open project: dotob/moni

Public Methods

Method Description
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

Method Details

SplitOnFirst() public static method

public static SplitOnFirst ( this s, string separator ) : string>.Tuple
s this
separator string
return string>.Tuple

SplitOnLast() public static method

public static SplitOnLast ( this s, string separator ) : string>.Tuple
s this
separator string
return string>.Tuple

SplitWithIgnoreRegions() public static method

public static SplitWithIgnoreRegions ( this s, char separators ) : IEnumerable
s this
separators char
return IEnumerable

Token() public static method

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
return string

Token() public static method

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
return string

TokenReturnInputIfFail() public static method

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
return string