StringExtensions Class

Class containing extension methods for common functionality on the string type

Definition

Namespace: PCBI_CadanceFab_Import
Assembly: PCBI_CadanceFab_Import (in PCBI_CadanceFab_Import.dll) Version: 16.0.0.0 (16.0.0.0)
C#
public static class StringExtensions
Inheritance
Object    StringExtensions

Methods

AllBetween(String, Char) Extracts all parts from the input string between the first encounter of a couple of enclosure character
AllBetween(String, String) Extracts all parts from the input string between the first encounter of a couple of enclosures
AllBetween(String, Char, Char) Extracts all parts from the input string between the first encounter of a the first enclosure character until the first encounter of the second enclosure character
AllBetween(String, String, StringComparison) Extracts the part from the input string between all encounters of a couple of outer enclosures
AllBetween(String, String, String, StringComparison) Extracts the part from the input string between all encounters of a couple of outer enclosures
AppendPrefixIfMissing Appends the prefix to the start of the string if the string does not already start with prefix.
AppendSuffixIfMissing Appends the suffix to the end of the string if the string does not already end in the suffix.
Between(String, Char) Extracts the part from the input string between the first encounter of a couple of enclosure character
Between(String, String) Extracts the part from the input string between the first encounter of a couple of enclosures
Between(String, Char, Char) Extracts the part from the input string between the first encounter of a the first enclosure character until the first encounter of the second enclosure character
Between(String, String, StringComparison) Extracts the part from the input string between the first encounter of a couple of enclosures
Between(String, String, String, StringComparison) Extracts the part from the input string between the first encounter of a couple of enclosures
Capitalize Read in a sequence of words from standard input and capitalize each one (make first letter uppercase; make rest lowercase).
Contains(String, String, StringComparison) Determines whether the given value can be located within the input string
Contains(String, String, Int32, Int32, StringComparison) Determines whether the given value can be located within the input string given the specified range
CountOccurrences Count number of occurrences in string
CountSubstring(String, String) Counts the total amount of occurrences of value within the inputString
CountSubstring(String, String, StringComparison) Counts the total amount of occurrences of value at the end of the inputString with an explicitly defined comparisonType
CountSubstring(String, String, Int32, Int32, StringComparison) Counts the total amount of occurrences of value at the end of the inputString with an explicitly defined comparisonType
CountSubstringEnd(String, String) Counts the total amount of occurrences of value at the end of the inputString
CountSubstringEnd(String, String, StringComparison) Counts the total amount of occurrences of value at the end of the inputString with an explicitly defined comparisonType
CountSubstringStart(String, String) Counts the total amount of occurrences of startsWith at the start of inputString
CountSubstringStart(String, String, StringComparison) Counts the total amount of occurrences of startsWith at the start of inputString
CreateHashSha256 Convert string to Hash using Sha256
CreateHashSha512 Convert string to Hash using Sha512
Decrypt Decrypt a string using the supplied key. Decoding is done using RSA encryption.
DoesNotEndWith Check if a string does not end with prefix
DoesNotStartWith Check if a string does not start with prefix
Encrypt Encrypt a string using the supplied key. Encoding is done using RSA encryption.
EndsWithIgnoreCase Check a String ends with another string ignoring the case.
Format(String, Object) Replaces one or more format items in a specified string with the string representation of a specified object.
Format(String, Object) Replaces the format item in a specified string with the string representation of a corresponding object in a specified array.
FristCharacter Gets first character in string
GetByteSize Calculates the amount of bytes occupied by the input string encoded as the encoding specified
GetDefaultIfEmpty Function returns a default String value if given value is null or empty
GetEmptyStringIfNull Gets empty String if passed value is of type Null/Nothing
GetLength Gets the number of characters in string checks if string is null
GetNullIfEmptyString Checks if a string is null and returns String if not Empty else returns null/Nothing
IsAlpha Checks if the String contains only Unicode letters. null will return false. An empty String ("") will return false.
IsAlphaNumeric Checks if the String contains only Unicode letters, digits. null will return false. An empty String ("") will return false.
IsDateTime Checks if date with dateFormat is parse-able to System.DateTime format returns boolean value if true else false
IsEmailAddress Validate email address
IsEmpty Determines whether the input string is empty (0 characters)
IsEmptyOrWhiteSpace Determines whether the input string is empty (0 characters) or consists of only whitespaces
IsInteger IsInteger Function checks if a string is a valid int32 value
IsLength Checks if string length satisfies minimum and maximum allowable char length. does not ignore leading and trailing white-space
IsMaxLength Checks if string length is consists of specified allowable maximum char length. does not ignore leading and trailing white-space. null strings will always evaluate to false.
IsMinLength Checks if string length is a certain minimum number of characters, does not ignore leading and trailing white-space. null strings will always evaluate to false.
IsNull Checks if a string is null
IsNumeric IsNumeric checks if a string is a valid floating value
IsValidIPv4 Validates if a string is valid IPv4 Regular expression taken from Regex reference
LastCharacter Gets last character in string
Left Extracts the left part of the input string limited with the length parameter
LeftOf(String, Char) Extracts the left part of the input string limited by the first character
LeftOf(String, String) Extracts the left part of the input string limited by the first occurrence of value
LeftOf(String, Char, Int32) Extracts the left part of the input string limited by the first character
LeftOf(String, String, StringComparison) Extracts the left part of the input string limited by the first occurrence of value
LeftOf(String, String, Int32, StringComparison) Extracts the left part of the input string limited by the n'th occurrence of value
LeftOfLast(String, Char) Extracts the left part of the input string limited by the last character
LeftOfLast(String, String) Extracts the left part of the input string limited by the last occurrence of value
LeftOfLast(String, String, StringComparison) Extracts the left part of the input string limited by the last occurrence of value
ParseStringToCsv Appends String quotes for type CSV data
QueryStringToDictionary Convert url query string to IDictionary value key pair
RemoveChars Remove Characters from string
RemovePrefix Removes the first part of the string, if no match found return original string
RemoveSuffix Removes the end part of the string, if no match found return original string
Replace(String, Char) Replace specified characters with an empty string.
Replace(String, String, String, StringComparison) Replaces all occurrences of a specified string with another specified string. This method differs from the version found in the BCL by accepting a StringComparison instance
Replace(String, String, String, Int32, Int32, StringComparison) Replaces all occurrences of a specified string with another specified string.
Replace(String, String, String, Int32, Int32, StringComparison, Int32) Replaces all occurrences of a specified string with another specified string.
ReplaceLineFeeds Replace Line Feeds
Reverse(String) Reverses all characters in input
Reverse(String, Int32, Int32) Reverses all characters in input within the range from startIndex till length
ReverseSlash Reverse back or forward slashes
Right Extracts the right part of the input string limited with the length parameter
RightOf(String, Char) Extracts the right part of the input string limited by the first character
RightOf(String, String) Extracts the right part of the input string limited by the first occurrence of value
RightOf(String, Char, Int32) Extracts the right part of the input string limited by the first character
RightOf(String, String, StringComparison) Extracts the right part of the input string limited by the first occurrence of value
RightOf(String, String, Int32, StringComparison) Extracts the right part of the input string limited by the n'th occurrence of value
RightOfLast(String, Char) Extracts the right part of the input string limited by the last character
RightOfLast(String, String) Extracts the right part of the input string limited by the last occurrence of value
RightOfLast(String, String, StringComparison) Extracts the right part of the input string limited by the last occurrence of value
Size(String) Calculates the amount of bytes occupied by the input string
Size(String, Encoding) Calculates the amount of bytes occupied by the input string encoded as the encoding specified
SizeAs(String, Encoding) Calculates the amount of bytes occupied by the input string when being encoded as the target encoding
SizeAs(String, Encoding, Encoding) Calculates the amount of bytes occupied by the input string encoded as the encoding specified when being encoded as the target encoding
SplitToT(String, Char) Returns an enumerable collection of the specified type containing the substrings in this instance that are delimited by elements of a specified Char array
SplitToT(String, StringSplitOptions, Char) Returns an enumerable collection of the specified type containing the substrings in this instance that are delimited by elements of a specified Char array
StartsWithIgnoreCase Check a String starts with another string ignoring the case.
TextElements Get all text elements within the input string
TextElementSegments Get all text element segments within a string
ToBoolean Converts string to its boolean equivalent
ToBytes Convert a string to its equivalent byte array
ToDecimal Converts the string representation of a number to its System.Decimal equivalent
ToDouble(String) Converts the string representation of a number to its System.Double equivalent
ToDouble(String, Double) 
ToEnumT Converts string to its Enum type Checks of string is a member of type T enum before converting if fails returns default enum
ToInt16 Converts the string representation of a number to its 16-bit signed integer equivalent
ToInt32 Converts the string representation of a number to its 32-bit signed integer equivalent
ToInt64 Converts the string representation of a number to its 64-bit signed integer equivalent
ToTextElements ToTextElements
TrimEnd(String, String) Trims all occurrences of the provided value instance from the end of the input string
TrimEnd(String, String, StringComparison) Trims all occurrences of the provided value instance from the end of the input string
TrimEnd(String, String, StringComparison, Int32) Trims all occurrences of the provided value instance from the end of the input string
TrimEnd(String, String, StringComparison, Int32, Int32) Trims all occurrences of the provided value instance from the end of the input string
TrimEndOnce(String, String) Trims the last occurrence of the provided value instance from the end of the input string
TrimEndOnce(String, String, StringComparison) Trims the last occurrence of the provided value instance from the end of the input string
TrimStart(String, String) Trims all occurrences of the provided startsWith instance from the start of the input string
TrimStart(String, String, StringComparison) Trims all occurrences of the provided startsWith instance from the start of the input string
TrimStart(String, String, StringComparison, Int32) Trims max occurrences of the provided startsWith instance from the start of the input string
TrimStart(String, String, StringComparison, Int32, Int32) Trims max occurrences of the provided startsWith instance from the start of the input string
TrimStartOnce(String, String) Trims the first occurrence of the provided startsWith instance from the start of the input string
TrimStartOnce(String, String, StringComparison) Trims the first occurrence of the provided startsWith instance from the start of the input string
Truncate(String, Int32) Truncate String and append ... at end
Truncate(String, Int32, String) Truncates the input string given to the length specified and possibly adds an ellipsis at the end to mark a truncation
Truncate(String, Int32, String, Boolean) Truncates the input string given to the length specified and possibly adds an ellipsis at the end to mark a truncation
Truncate(String, Int32, String, Boolean, String, Boolean, StringComparison) Truncates the input string given to the length specified and possibly adds an ellipsis at the end to mark a truncation
Width Calculates the amount of printable characters within this string. This includes surrogate pairs and mark characters

See Also