Class StringExtensions
Inheritance
System.Object
StringExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Bayat.Core.Runtime.dll
Syntax
public static class StringExtensions
Methods
|
Improve this Doc
View Source
AllIndexesOf(String, String)
Declaration
public static IEnumerable<int> AllIndexesOf(this string haystack, string needle)
Parameters
Type |
Name |
Description |
System.String |
haystack |
|
System.String |
needle |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.Int32> |
|
|
Improve this Doc
View Source
AppendLineFormat(StringBuilder, String, Object[])
Declaration
public static void AppendLineFormat(this StringBuilder sb, string format, params object[] args)
Parameters
Type |
Name |
Description |
System.Text.StringBuilder |
sb |
|
System.String |
format |
|
System.Object[] |
args |
|
|
Improve this Doc
View Source
Contains(String, Char)
Declaration
public static bool Contains(this string s, char c)
Parameters
Type |
Name |
Description |
System.String |
s |
|
System.Char |
c |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
ContainsInsensitive(String, String)
Declaration
public static bool ContainsInsensitive(this string haystack, string needle)
Parameters
Type |
Name |
Description |
System.String |
haystack |
|
System.String |
needle |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
CountIndices(String, Char)
Declaration
public static int CountIndices(this string s, char c)
Parameters
Type |
Name |
Description |
System.String |
s |
|
System.Char |
c |
|
Returns
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
EndsWith(String, Char)
Declaration
public static bool EndsWith(this string s, char c)
Parameters
Type |
Name |
Description |
System.String |
s |
|
System.Char |
c |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
FallbackEmpty(String, String)
Declaration
public static string FallbackEmpty(string s, string fallback)
Parameters
Type |
Name |
Description |
System.String |
s |
|
System.String |
fallback |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
FallbackWhitespace(String, String)
Declaration
public static string FallbackWhitespace(string s, string fallback)
Parameters
Type |
Name |
Description |
System.String |
s |
|
System.String |
fallback |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
Filter(String, Boolean, Boolean, Boolean, Boolean, Boolean)
Declaration
public static string Filter(this string s, bool letters = true, bool numbers = true, bool whitespace = true, bool symbols = true, bool punctuation = true)
Parameters
Type |
Name |
Description |
System.String |
s |
|
System.Boolean |
letters |
|
System.Boolean |
numbers |
|
System.Boolean |
whitespace |
|
System.Boolean |
symbols |
|
System.Boolean |
punctuation |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
FilterReplace(String, Char, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean)
Declaration
public static string FilterReplace(this string s, char replacement, bool merge, bool letters = true, bool numbers = true, bool whitespace = true, bool symbols = true, bool punctuation = true)
Parameters
Type |
Name |
Description |
System.String |
s |
|
System.Char |
replacement |
|
System.Boolean |
merge |
|
System.Boolean |
letters |
|
System.Boolean |
numbers |
|
System.Boolean |
whitespace |
|
System.Boolean |
symbols |
|
System.Boolean |
punctuation |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
FirstCharacterToLower(String)
Declaration
public static string FirstCharacterToLower(this string s)
Parameters
Type |
Name |
Description |
System.String |
s |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
FirstCharacterToUpper(String)
Declaration
public static string FirstCharacterToUpper(this string s)
Parameters
Type |
Name |
Description |
System.String |
s |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
IsGuid(String)
Declaration
public static bool IsGuid(string value)
Parameters
Type |
Name |
Description |
System.String |
value |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
IsNullOrWhiteSpace(String)
Declaration
public static bool IsNullOrWhiteSpace(string s)
Parameters
Type |
Name |
Description |
System.String |
s |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
IsWordBeginning(Nullable<Char>, Char, Nullable<Char>)
Declaration
public static bool IsWordBeginning(char? previous, char current, char? next)
Parameters
Type |
Name |
Description |
System.Nullable<System.Char> |
previous |
|
System.Char |
current |
|
System.Nullable<System.Char> |
next |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
IsWordBeginning(String, Int32)
Declaration
public static bool IsWordBeginning(string s, int index)
Parameters
Type |
Name |
Description |
System.String |
s |
|
System.Int32 |
index |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
IsWordDelimiter(Char)
Declaration
public static bool IsWordDelimiter(char c)
Parameters
Type |
Name |
Description |
System.Char |
c |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
NullIfEmpty(String)
Declaration
public static string NullIfEmpty(this string s)
Parameters
Type |
Name |
Description |
System.String |
s |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
PartAfter(String, Char)
Declaration
public static string PartAfter(this string s, char c)
Parameters
Type |
Name |
Description |
System.String |
s |
|
System.Char |
c |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
PartBefore(String, Char)
Declaration
public static string PartBefore(this string s, char c)
Parameters
Type |
Name |
Description |
System.String |
s |
|
System.Char |
c |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
PathEllipsis(String, Int32)
Declaration
public static string PathEllipsis(string s, int maxLength)
Parameters
Type |
Name |
Description |
System.String |
s |
|
System.Int32 |
maxLength |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
Prettify(String)
Declaration
public static string Prettify(this string s)
Parameters
Type |
Name |
Description |
System.String |
s |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
RemoveConsecutiveCharacters(String, Char)
Declaration
public static string RemoveConsecutiveCharacters(this string s, char c)
Parameters
Type |
Name |
Description |
System.String |
s |
|
System.Char |
c |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
ReplaceMultiple(String, HashSet<Char>, Char)
Declaration
public static string ReplaceMultiple(this string s, HashSet<char> haystacks, char replacement)
Parameters
Type |
Name |
Description |
System.String |
s |
|
System.Collections.Generic.HashSet<System.Char> |
haystacks |
|
System.Char |
replacement |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
SplitWords(String, Char)
Declaration
public static string SplitWords(this string s, char separator)
Parameters
Type |
Name |
Description |
System.String |
s |
|
System.Char |
separator |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
StartsWith(String, Char)
Declaration
public static bool StartsWith(this string s, char c)
Parameters
Type |
Name |
Description |
System.String |
s |
|
System.Char |
c |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
ToBinaryString(Enum)
Declaration
public static string ToBinaryString(this Enum value)
Parameters
Type |
Name |
Description |
System.Enum |
value |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
ToBinaryString(Int32)
Declaration
public static string ToBinaryString(this int value)
Parameters
Type |
Name |
Description |
System.Int32 |
value |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
ToBinaryString(Int64)
Declaration
public static string ToBinaryString(this long value)
Parameters
Type |
Name |
Description |
System.Int64 |
value |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
ToCommaSeparatedString(IEnumerable)
Declaration
public static string ToCommaSeparatedString(this IEnumerable enumerable)
Parameters
Type |
Name |
Description |
System.Collections.IEnumerable |
enumerable |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
ToLineSeparatedString(IEnumerable)
Declaration
public static string ToLineSeparatedString(this IEnumerable enumerable)
Parameters
Type |
Name |
Description |
System.Collections.IEnumerable |
enumerable |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
ToSeparatedString(IEnumerable, String)
Declaration
public static string ToSeparatedString(this IEnumerable enumerable, string separator)
Parameters
Type |
Name |
Description |
System.Collections.IEnumerable |
enumerable |
|
System.String |
separator |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
TrimEnd(String, String)
Declaration
public static string TrimEnd(this string source, string value)
Parameters
Type |
Name |
Description |
System.String |
source |
|
System.String |
value |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
TrimStart(String, String)
Declaration
public static string TrimStart(this string source, string value)
Parameters
Type |
Name |
Description |
System.String |
source |
|
System.String |
value |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
Truncate(String, Int32, String)
Declaration
public static string Truncate(this string value, int maxLength, string suffix = "...")
Parameters
Type |
Name |
Description |
System.String |
value |
|
System.Int32 |
maxLength |
|
System.String |
suffix |
|
Returns
Type |
Description |
System.String |
|