Click or drag to resize

StringExtensions Class

Defines extension functions related to string manipulation.
Inheritance Hierarchy
SystemObject
  GSFStringExtensions

Namespace: GSF
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.177-beta
Syntax
public static class StringExtensions
View Source

The StringExtensions type exposes the following members.

Methods
 NameDescription
Public Extension MethodBase64Decode Decodes a given base-64 encoded string encoded with Base64Encode(String).
Public Extension MethodBase64Encode Encodes a string into a base-64 string.
Public Extension MethodCenterText(String, Int32) Centers text within the specified maximum length, biased to the left. Text will be padded to the left and right with spaces. If value is greater than specified maximum length, value returned will be truncated from the right.
Public Extension MethodCenterText(String, Int32, Char) Centers text within the specified maximum length, biased to the left. Text will be padded to the left and right with specified padding character. If value is greater than specified maximum length, value returned will be truncated from the right.
Public Extension MethodCharCount Counts the total number of the occurrences of a character in the given string.
Public Extension MethodConvertToType(String, Type) Converts this string into the specified type.
Public Extension MethodConvertToType(String, Type, CultureInfo) Converts this string into the specified type.
Public Extension MethodConvertToTypeT(String) Converts this string into the specified type.
Public Extension MethodConvertToTypeT(String, CultureInfo) Converts this string into the specified type.
Public Extension MethodEnsureEnd(String, Char) Ensures a string ends with a specific character.
Public Extension MethodEnsureEnd(String, String) Ensures a string ends with a specific string.
Public Extension MethodEnsureEnd(String, Char, Boolean) Ensures a string ends with a specific character.
Public Extension MethodEnsureStart(String, Char) Ensures a string starts with a specific character.
Public Extension MethodEnsureStart(String, String) Ensures a string starts with a specific string.
Public Extension MethodEnsureStart(String, Char, Boolean) Ensures a string starts with a specific character.
Public Extension MethodGetComparer Gets appropriate StringComparer for the specified StringComparison.
Public Extension MethodGetSegments Turns source string into an array of string segments - each with a set maximum width - for parsing or displaying.
Public Extension MethodIndexOfNot(String, Char, Int32) Finds the first index that does not match the given character.
Public Extension MethodIndexOfNot(String, Char, Int32) Finds the first index that is NOT included in testChars
Public Extension MethodIndexOfNot(String, FuncChar, Boolean, Int32) Finds the first index that does NOT pass the characterTestFunction delegate function.
Public Extension MethodIndexOfPrevious(String, Char, Int32) Searches a string from right to left for the next instance of a specified character.
Public Extension MethodIndexOfPrevious(String, FuncChar, Boolean, Int32) Searches a string from right to left for the next instance of a character passing the specified delegate.
Public Extension MethodIndexOfPrevious(String, String, Int32, Boolean) Searches a string from right to left for the next instance of a specified string.
Public Extension MethodIndexOfPreviousNot(String, Char, Int32) Searches a string from right to left for the next instance of a character that is not the specified character.
Public Extension MethodIndexOfPreviousNot(String, Char, Int32) Searches a string from right to left for the next instance of a character that is not contained in the specified collection of characters.
Public Extension MethodIndexOfPreviousNot(String, FuncChar, Boolean, Int32) Searches a string from right to left for the next instance of a character that does not pass the given delegate function.
Public Extension MethodIndexOfRepeatedChar(String) Searches a string for an instance of a repeated character.
Public Extension MethodIndexOfRepeatedChar(String, Char) Searches a string for a repeated instance of the specified characterToFind.
Public Extension MethodIndexOfRepeatedChar(String, Int32) Searches a string for an instance of a repeated character from specified startIndex.
Public Extension MethodIndexOfRepeatedChar(String, Char, Int32) Searches a string for a repeated instance of the specified characterToFind from specified startIndex.
Public Extension MethodInterpolate(String, IEnumerableKeyValuePairString, Object) Applies string interpolation to the given format string at runtime.
Public Extension MethodInterpolateT(String, T) Applies string interpolation to the given format string at runtime.
Public Extension MethodIsAllDigits Tests to see if a string is contains only digits based on Char.IsDigit function.
Public Extension MethodIsAllLetters(String) Tests to see if a string contains only letters.
Public Extension MethodIsAllLetters(String, Boolean) Tests to see if a string contains only letters.
Public Extension MethodIsAllLettersOrDigits(String) Tests to see if a string contains only letters or digits.
Public Extension MethodIsAllLettersOrDigits(String, Boolean) Tests to see if a string contains only letters or digits.
Public Extension MethodIsAllLower Tests to see if a string's letters are all lower case.
Public Extension MethodIsAllNumbers Tests to see if a string contains only numbers based on Char.IsNumber function.
Public Extension MethodIsAllUpper Tests to see if a string's letters are all upper case.
Public Extension MethodIsNullOrWhiteSpace Test to see if the provided string is null or contains only whitespace characters.
Public Extension MethodIsPlural Determines whether the specified word is plural.
Public Extension MethodIsSingular Determines whether the specified word is singular.
Public Extension MethodJoinKeyValuePairs Combines a dictionary of key-value pairs in to a string.
Public Extension MethodNotEmpty(String) Ensures parameter is not an empty or null string. Returns a single space if test value is empty.
Public Extension MethodNotEmpty(String, String) Ensures parameter is not an empty or null string.
Public Extension MethodParseBoolean Parses a string intended to represent a boolean value.
Public Extension MethodParseKeyValuePairs Parses key/value pair expressions from a string. Parameter pairs are delimited by keyValueDelimiter and multiple pairs separated by parameterDelimiter. Supports encapsulated nested expressions.
Public Extension MethodQuoteUnwrap(String, Char) Unwraps quotes similar to Excel. However, a little more predictable for unusual edge cases.
Public Extension MethodQuoteUnwrap(String, Char) Unwraps quotes similar to Excel. However, a little more predictable for unusual edge cases.
Public Extension MethodQuoteWrap Wraps value in the quoteChar.
Public Extension MethodRegexDecode Decodes the specified Regular Expression character back into a standard Unicode character.
Public Extension MethodRemoveCharacter Removes all characters matching the given characterToRemove.
Public Extension MethodRemoveCharacters Removes all characters passing delegate test from a string.
Public Extension MethodRemoveControlCharacters Removes all control characters from a string.
Public Extension MethodRemoveCrLfs Removes all carriage returns and line feeds from a string.
Public Extension MethodRemoveDuplicates Removes duplicate character strings (adjoining replication) in a string.
Public Extension MethodRemoveDuplicateWhiteSpace(String) Replaces all repeating white space with a single space.
Public Extension MethodRemoveDuplicateWhiteSpace(String, Char) Replaces all repeating white space with specified spacing character.
Public Extension MethodRemoveInvalidFileNameCharacters Removes all invalid file name characters (\ / : * ? " < > |) from a string.
Public Extension MethodRemoveLeadingString(String, Char, Boolean) Removes one or more instances of a specified char from the beginning of a string.
Public Extension MethodRemoveLeadingString(String, String, Boolean) Removes one or more instances of a specified string from the beginning of a string.
Public Extension MethodRemoveLeadingZeros Assures that numeric value is a well formed number Adds a leading zero in front of a decimal, if present
Public Extension MethodRemoveNull Removes the terminator ('\0') from a null terminated string.
Public Extension MethodRemoveTrailingString(String, Char, Boolean) Removes one or more instances of a character from the end of a string
Public Extension MethodRemoveTrailingString(String, String, Boolean) Removes one or more instances of a string from the end of a string
Public Extension MethodRemoveWhiteSpace Removes all white space (as defined by IsWhiteSpace) from a string.
Public Extension MethodReplaceCaseInsensitive Performs a case insensitive string replacement.
Public Extension MethodReplaceCharacters Replaces all characters passing delegate test with specified replacement character.
Public Extension MethodReplaceControlCharacters(String) Replaces all control characters in a string with a single space.
Public Extension MethodReplaceControlCharacters(String, Char) Replaces all control characters in a string with specified replacement character.
Public Extension MethodReplaceCrLfs Replaces all carriage return and line feed characters (as well as CR/LF sequences) in a string with specified replacement character.
Public Extension MethodReplaceInvalidFileNameCharacters Replaces all invalid file name characters (\ / : * ? " < > |) in a string with the specified replacementCharacter.
Public Extension MethodReplaceWhiteSpace Replaces all white space characters (as defined by IsWhiteSpace) with specified replacement character.
Public Extension MethodReverse Reverses the order of the characters in a string.
Public Extension MethodStringCount Counts the total number of the occurrences of string within a string
Public Extension MethodSubstringEnd Returns a string consisting of a specified number of characters from the end of a string "to the left"
Public Extension MethodSubstringPrevious Returns a string consisting of a specified number of characters to the left (previous chars) from the provided startIndex
Public Extension MethodToCamelCase Converts first letter of string to lower-case.
Public Extension MethodToPascalCase Converts first letter of string to upper-case.
Public Extension MethodToPlural Returns the plural form of the specified word.
Public Extension MethodToSecureString Converts the given string into a SecureString.
Public Extension MethodToSingular Returns the singular form of the specified word.
Public Extension MethodToStream Converts string into a stream using the specified encoding.
Public Extension MethodToStreamAsync Asynchronously converts string into a stream using the specified encoding.
Public Extension MethodToTitleCase Converts the provided string into title case (upper case first letter of each word).
Public Extension MethodToUnsecureString Converts the given SecureString into a String.
Public Extension MethodTrimWithEllipsisEnd Places an ellipsis at the end of a string as it is trimmed to length specified.
Public Extension MethodTrimWithEllipsisMiddle Places an ellipsis in the middle of a string as it is trimmed to length specified.
Public Extension MethodTruncateLeft Truncates the provided string from the left if it is longer that specified length.
Public Extension MethodTruncateRight Truncates the provided string from the right if it is longer that specified length.
Public Extension MethodUriEncode Escapes string using URL encoding.
Top
See Also

Reference

GSF Namespace