C# Класс Org.IdentityConnectors.Common.StringUtil

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

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

Метод Описание
EndsWith ( string str, char value ) : bool

Determines if the string parameter 'str' ends with the character value.

IndexOf ( string src, char ch ) : int
IndexOf ( string src, char ch, int idx ) : int
IndexOfDigit ( string str ) : int

Finds the index of the first digit.

IndexOfDigit ( string str, int startidx ) : int

Finds the index of the first digit and starts from the index specified.

IndexOfIgnoreCase ( string src, string cmp ) : int

Finds the start index of the comparison string regards of case.

IndexOfNonDigit ( string str ) : int

Finds the index of the first non digit.

IndexOfNonDigit ( string str, int startidx ) : int

Finds the index of the first non digit and starts from the index specified.

IsBlank ( string val ) : bool

Checks if a String is whitespace, empty ("") or null.

 StringUtil.IsBlank(null)      = true StringUtil.IsBlank("")        = true StringUtil.IsBlank(" ")       = true StringUtil.IsBlank("bob")     = false StringUtil.IsBlank("  bob  ") = false 

IsEmpty ( string value ) : bool

Determines if a string is empty. Empty is defined as null or empty string.

 StringUtil.IsEmpty(null)     = true StringUtil.IsEmpty("")       = true StringUtil.IsEmpty(" ")      = false StringUtil.IsEmpty("bob")    = false StringUtil.IsEmpty(" bob ")  = false 

IsNotBlank ( string val ) : bool

Checks if a String is not empty (""), not null and not whitespace only.

 StringUtil.IsNotBlank(null)      = false StringUtil.IsNotBlank("")        = false StringUtil.IsNotBlank(" ")       = false StringUtil.IsNotBlank("bob")     = true StringUtil.IsNotBlank("  bob  ") = true 

IsNotEmpty ( string val ) : bool

Determines if a string is not empty. Its the exact opposite for #IsEmpty(String).

IsTrue ( string val ) : bool
IsWhitespace ( char ch ) : bool

Determine if this is a white space character. Whitespace characters are defined as the character ' ' and the tab character.

NewGuardedString ( char val ) : GuardedString

Constructs a secure string from a char []. The char[] will be cleared out when finished.

ParseLine ( string line, char fsep, char tqul ) : IList

Parses a line into a List of strings.

RandomString ( ) : string

Create a random Unicode string.

RandomString ( Random r ) : string

Create a random length Unicode string based on the Random object passed in.

RandomString ( Random random, int length ) : string

Create a random string of fixed length based on the Random object passed in. Insure that the string is built w/ Unicode characters.

ReplaceVariable ( string o, string variable, string val ) : string

Simple variable replacement internally using regular expressions.

 String o = "Some string with a ${variable} in it." String n = replaceVariable(o, "variable", "something"); String r = "Some string with a something in it" assert r.equals(n); 

StripNewlines ( string src ) : string

Removes newline characters (0x0a and 0x0d) from a string.

StripXmlAttribute ( string src, string attrName ) : string

Removes the attribute from the source string and returns.

StripXmlComments ( string src ) : string

Strip XML comments.

SubDigitString ( string str ) : string

Return the string of digits from string.

SubDigitString ( string str, int idx ) : string

Return the string of digits from string.

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

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

Determines if the string parameter 'str' ends with the character value.
public static EndsWith ( string str, char value ) : bool
str string /// String to check for the character at the end.
value char /// The character to look for at the end of the string.
Результат bool

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

public static IndexOf ( string src, char ch ) : int
src string
ch char
Результат int

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

public static IndexOf ( string src, char ch, int idx ) : int
src string
ch char
idx int
Результат int

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

Finds the index of the first digit.
public static IndexOfDigit ( string str ) : int
str string /// String to seach for a digit.
Результат int

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

Finds the index of the first digit and starts from the index specified.
public static IndexOfDigit ( string str, int startidx ) : int
str string /// String to search for a digit.
startidx int /// Starting index from which to search
Результат int

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

Finds the start index of the comparison string regards of case.
public static IndexOfIgnoreCase ( string src, string cmp ) : int
src string /// String to search.
cmp string /// Comparsion string to find.
Результат int

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

Finds the index of the first non digit.
public static IndexOfNonDigit ( string str ) : int
str string /// String to seach for a non digit.
Результат int

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

Finds the index of the first non digit and starts from the index specified.
public static IndexOfNonDigit ( string str, int startidx ) : int
str string /// String to seach for a non digit.
startidx int /// Starting index from which to search.
Результат int

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

Checks if a String is whitespace, empty ("") or null.
 StringUtil.IsBlank(null)      = true StringUtil.IsBlank("")        = true StringUtil.IsBlank(" ")       = true StringUtil.IsBlank("bob")     = false StringUtil.IsBlank("  bob  ") = false 
public static IsBlank ( string val ) : bool
val string /// the String to check, may be null ///
Результат bool

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

Determines if a string is empty. Empty is defined as null or empty string.
 StringUtil.IsEmpty(null)     = true StringUtil.IsEmpty("")       = true StringUtil.IsEmpty(" ")      = false StringUtil.IsEmpty("bob")    = false StringUtil.IsEmpty(" bob ")  = false 
public static IsEmpty ( string value ) : bool
value string
Результат bool

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

Checks if a String is not empty (""), not null and not whitespace only.
 StringUtil.IsNotBlank(null)      = false StringUtil.IsNotBlank("")        = false StringUtil.IsNotBlank(" ")       = false StringUtil.IsNotBlank("bob")     = true StringUtil.IsNotBlank("  bob  ") = true 
public static IsNotBlank ( string val ) : bool
val string /// the String to check, may be null ///
Результат bool

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

Determines if a string is not empty. Its the exact opposite for #IsEmpty(String).
public static IsNotEmpty ( string val ) : bool
val string /// string to evaluate.
Результат bool

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

public static IsTrue ( string val ) : bool
val string
Результат bool

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

Determine if this is a white space character. Whitespace characters are defined as the character ' ' and the tab character.
public static IsWhitespace ( char ch ) : bool
ch char
Результат bool

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

Constructs a secure string from a char []. The char[] will be cleared out when finished.
public static NewGuardedString ( char val ) : GuardedString
val char The characters to use. Will be cleared /// out.
Результат GuardedString

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

Parses a line into a List of strings.
public static ParseLine ( string line, char fsep, char tqul ) : IList
line string /// String to parse.
fsep char /// Field separator
tqul char /// Text qualifier.
Результат IList

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

Create a random Unicode string.
public static RandomString ( ) : string
Результат string

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

Create a random length Unicode string based on the Random object passed in.
public static RandomString ( Random r ) : string
r System.Random
Результат string

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

Create a random string of fixed length based on the Random object passed in. Insure that the string is built w/ Unicode characters.
public static RandomString ( Random random, int length ) : string
random System.Random /// used to get random unicode characters.
length int /// fixed length of string.
Результат string

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

Simple variable replacement internally using regular expressions.
 String o = "Some string with a ${variable} in it." String n = replaceVariable(o, "variable", "something"); String r = "Some string with a something in it" assert r.equals(n); 
/// if o is null, var is blank, or val is null.
public static ReplaceVariable ( string o, string variable, string val ) : string
o string /// Original string to do the replacement on.
variable string /// String representation of the variable to replace.
val string /// Value to replace the variable with.
Результат string

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

Removes newline characters (0x0a and 0x0d) from a string.
public static StripNewlines ( string src ) : string
src string
Результат string

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

Removes the attribute from the source string and returns.
public static StripXmlAttribute ( string src, string attrName ) : string
src string
attrName string
Результат string

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

Strip XML comments.
public static StripXmlComments ( string src ) : string
src string
Результат string

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

Return the string of digits from string.
public static SubDigitString ( string str ) : string
str string /// Source string to search.
Результат string

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

Return the string of digits from string.
public static SubDigitString ( string str, int idx ) : string
str string /// Source string to search.
idx int /// Start index from which to search.
Результат string