-
Notifications
You must be signed in to change notification settings - Fork 2
BizArk.Core.Extensions.StringExt
Brian Brewder edited this page Apr 2, 2017
·
1 revision
Back to BizArk.Core API Reference
Provides extension methods for strings.
-
public static byte DefaultWrapTabWidth { get; set; }- Gets or sets the size of a TAB (number of spaces). Used for calculating word wraps. -
public static char[] Vowels { get; set; }= { 'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U' };- Vowels. Used for IsVowel.
-
public static bool HasValue(this string str)- Shortcut for !ConvertEx.IsEmpty. Works because this is an extension method, not a real method. -
public static string IfEmpty(this string str, string dflt)- If the string is empty, returns the default. -
public static bool IsAscii(this string str)- Determines if a string consists of all valid ASCII values. -
public static bool IsEmpty(this string str)- Shortcut for ConvertEx.IsEmpty. Works because this is an extension method, not a real method. -
public static bool IsVowel(this char ch)- Determines if the character is a vowel. Uses StringExt.Vowels to determine vowels. -
public static string Left(this string str, int length)- Truncates the string. -
public static string Left(this string str, string find)- Gets everything to the left of the find string. -
public static string[] Lines(this string str)- Splits the string into lines. -
public static string Right(this string str, int length)- Gets the right side of the string. -
public static string Right(this string str, string find)- Gets everything to the right of the find string. -
public static byte[] SHA256(this string str, byte[] salt = null)- Hashes the string using SHA-256. -
public static byte[] SHA256(this string str, string salt = null)- Hashes the string using SHA-256. -
public static byte[] SHA512(this string str, byte[] salt = null)- Hashes the string using SHA-512. -
public static byte[] SHA512(this string str, string salt = null)- Hashes the string using SHA-512. -
public static string[] Split(this string str, char separator, bool trim)- Splits a string on the given char and if trim is true, removes leading and trailing whitespace characters from each element. -
public static string[] Split(this string str, char separator, bool trim, bool removeEmpties)- Splits a string on the given char and if trim is true, removes leading and trailing whitespace characters from each element. -
public static T[] Split<T>(this string str, char separator)- Splits a string on the given char and if trim is true, removes leading and trailing whitespace characters from each element. -
public static T[] Split<T>(this string str, char separator, bool removeEmpties)- Splits a string on the given char and if trim is true, removes leading and trailing whitespace characters from each element. -
public static T[] Split<T>(this string str, params char[] separator)- Returns an array split along the separator. -
public static byte[] ToBytes(this string str, Encoding encoding = null)- Puts the string into an array of bytes. -
public static Stream ToStream(this string str, Encoding encoding = null)- Puts the string into a MemoryStream. Resets the MemoryStream to position 0 so it can be read from. -
public static string[] Words(this string str)- Splits the string into words (all white space is removed). -
public static string Wrap(this string str, int maxWidth, string prefix = "")- Forces the string to word wrap so that each line doesn't exceed the maxLineLength. -
public static string Wrap(this string str, StringWrapOptions options)- Forces the string to word wrap so that each line doesn't exceed the maxLineLength. -
public static string[] WrappedLines(this string str, int maxWidth, string prefix)- Forces the string to word wrap so that each line doesn't exceed the maxLineLength. -
public static string[] WrappedLines(this string str, StringWrapOptions options)- Forces the string to word wrap so that each line doesn't exceed the maxLineLength.
-
public static StringBuilder AppendIf(this StringBuilder sb, bool condition, string value)- Appends a copy of the specified string to this instance if the condition is true. -
public static StringBuilder AppendIf(this StringBuilder sb, string value)- Appends a copy of the specified string to this instance if the value is not null or empty. -
public static StringBuilder AppendLineIf(this StringBuilder sb, bool condition, string value)- Appends a copy of the specified string followed by the default line terminator to the end of the current System.Text.StringBuilder object if the condition is true. -
public static StringBuilder AppendLineIf(this StringBuilder sb, string value)- Appends a copy of the specified string followed by the default line terminator to the end of the current System.Text.StringBuilder object if the value is not null or empty. -
public static string IfEmpty(this StringBuilder sb, string dflt)- If the string is empty, returns the default. -
public static string Substring(this StringBuilder sb, int startIndex)- Retrieves a substring from this instance. The substring starts at a specified character position and continues to the end of the string. -
public static string Substring(this StringBuilder sb, int startIndex, int length)- Retrieves a substring from this instance. The substring starts at a specified character position and continues to the end of the string. -
public static string Trim(this StringBuilder sb)- Removes all leading and trailing white-space characters from the current System.String object. -
public static string TrimEnd(this StringBuilder sb)- Removes all trailing occurrences of a set of characters specified in an array from the current System.String object.