StringExtensions
Assembly: ServiceStack.Text.dll
View Source
public static class StringExtensions
Methods
BaseConvert(String, Int32, Int32)
Converts from base: 0 - 62
View Source
public static string BaseConvert(this string source, int from, int to)
Returns
System.String
Parameters
Type | Name | Description |
---|---|---|
System.String | source | The source. |
|
| System.Int32
| from | From.
|
| System.Int32
| to | To.
|
EncodeXml(String)
View Source
public static string EncodeXml(this string value)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | value |
EncodeJson(String)
View Source
public static string EncodeJson(this string value)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | value |
EncodeJsv(String)
View Source
public static string EncodeJsv(this string value)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | value |
DecodeJsv(String)
View Source
public static string DecodeJsv(this string value)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | value |
UrlEncode(String, Boolean)
View Source
public static string UrlEncode(this string text, bool upperCase = false)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
System.Boolean | upperCase |
UrlDecode(String)
View Source
public static string UrlDecode(this string text)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
HexUnescape(String, Char[])
View Source
public static string HexUnescape(this string text, params char[] anyCharOf)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
System.Char[] | anyCharOf |
UrlFormat(String, String[])
View Source
public static string UrlFormat(this string url, params string[] urlComponents)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | url |
System.String[] | urlComponents |
ToRot13(String)
View Source
public static string ToRot13(this string value)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | value |
UrlWithTrailingSlash(String)
View Source
public static string UrlWithTrailingSlash(this string url)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | url |
WithTrailingSlash(String)
View Source
public static string WithTrailingSlash(this string path)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | path |
AppendPath(String, String[])
View Source
public static string AppendPath(this string uri, params string[] uriComponents)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | uri |
System.String[] | uriComponents |
AppendUrlPaths(String, String[])
View Source
public static string AppendUrlPaths(this string uri, params string[] uriComponents)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | uri |
System.String[] | uriComponents |
AppendUrlPathsRaw(String, String[])
View Source
public static string AppendUrlPathsRaw(this string uri, params string[] uriComponents)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | uri |
System.String[] | uriComponents |
FromUtf8Bytes(Byte[])
View Source
public static string FromUtf8Bytes(this byte[] bytes)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Byte[] | bytes |
ToUtf8Bytes(String)
View Source
public static byte[] ToUtf8Bytes(this string value)
Returns
System.Byte[]
Parameters
Type | Name |
---|---|
System.String | value |
ToUtf8Bytes(Int32)
View Source
public static byte[] ToUtf8Bytes(this int intVal)
Returns
System.Byte[]
Parameters
Type | Name |
---|---|
System.Int32 | intVal |
ToUtf8Bytes(Int64)
View Source
public static byte[] ToUtf8Bytes(this long longVal)
Returns
System.Byte[]
Parameters
Type | Name |
---|---|
System.Int64 | longVal |
ToUtf8Bytes(UInt64)
View Source
public static byte[] ToUtf8Bytes(this ulong ulongVal)
Returns
System.Byte[]
Parameters
Type | Name |
---|---|
System.UInt64 | ulongVal |
ToUtf8Bytes(Double)
View Source
public static byte[] ToUtf8Bytes(this double doubleVal)
Returns
System.Byte[]
Parameters
Type | Name |
---|---|
System.Double | doubleVal |
WithoutBom(String)
View Source
public static string WithoutBom(this string value)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | value |
ToBase64UrlSafe(Byte[])
View Source
public static string ToBase64UrlSafe(this byte[] input)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Byte[] | input |
ToBase64UrlSafe(MemoryStream)
View Source
public static string ToBase64UrlSafe(this MemoryStream ms)
Returns
System.String
Parameters
Type | Name |
---|---|
System.IO.MemoryStream | ms |
FromBase64UrlSafe(String)
View Source
public static byte[] FromBase64UrlSafe(this string input)
Returns
System.Byte[]
Parameters
Type | Name |
---|---|
System.String | input |
LeftPart(String, Char)
View Source
public static string LeftPart(this string strVal, char needle)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | strVal |
System.Char | needle |
LeftPart(String, String)
View Source
public static string LeftPart(this string strVal, string needle)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | strVal |
System.String | needle |
RightPart(String, Char)
View Source
public static string RightPart(this string strVal, char needle)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | strVal |
System.Char | needle |
RightPart(String, String)
View Source
public static string RightPart(this string strVal, string needle)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | strVal |
System.String | needle |
LastLeftPart(String, Char)
View Source
public static string LastLeftPart(this string strVal, char needle)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | strVal |
System.Char | needle |
LastLeftPart(String, String)
View Source
public static string LastLeftPart(this string strVal, string needle)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | strVal |
System.String | needle |
LastRightPart(String, Char)
View Source
public static string LastRightPart(this string strVal, char needle)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | strVal |
System.Char | needle |
LastRightPart(String, String)
View Source
public static string LastRightPart(this string strVal, string needle)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | strVal |
System.String | needle |
SplitOnFirst(String, Char)
View Source
public static string[] SplitOnFirst(this string strVal, char needle)
Returns
System.String[]
Parameters
Type | Name |
---|---|
System.String | strVal |
System.Char | needle |
SplitOnFirst(String, String)
View Source
public static string[] SplitOnFirst(this string strVal, string needle)
Returns
System.String[]
Parameters
Type | Name |
---|---|
System.String | strVal |
System.String | needle |
SplitOnLast(String, Char)
View Source
public static string[] SplitOnLast(this string strVal, char needle)
Returns
System.String[]
Parameters
Type | Name |
---|---|
System.String | strVal |
System.Char | needle |
SplitOnLast(String, String)
View Source
public static string[] SplitOnLast(this string strVal, string needle)
Returns
System.String[]
Parameters
Type | Name |
---|---|
System.String | strVal |
System.String | needle |
WithoutExtension(String)
View Source
public static string WithoutExtension(this string filePath)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | filePath |
GetExtension(String)
View Source
public static string GetExtension(this string filePath)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | filePath |
ParentDirectory(String)
View Source
public static string ParentDirectory(this string filePath)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | filePath |
ToJsv<T>(T)
View Source
public static string ToJsv<T>(this T obj)
Returns
System.String
Parameters
Type | Name |
---|---|
<T> | obj |
Type Parameters
T
ToJsv<T>(T, Action<Config>)
View Source
public static string ToJsv<T>(this T obj, Action<Config> configure)
Returns
System.String
Parameters
Type | Name |
---|---|
<T> | obj |
System.Action<ServiceStack.Text.Config> | configure |
Type Parameters
T
ToSafeJsv<T>(T)
View Source
public static string ToSafeJsv<T>(this T obj)
Returns
System.String
Parameters
Type | Name |
---|---|
<T> | obj |
Type Parameters
T
FromJsv<T>(String)
View Source
public static T FromJsv<T>(this string jsv)
Returns
<T>
Parameters
Type | Name |
---|---|
System.String | jsv |
Type Parameters
T
FromJsvSpan<T>(ReadOnlySpan<Char>)
View Source
public static T FromJsvSpan<T>(this ReadOnlySpan<char> jsv)
Returns
<T>
Parameters
Type | Name |
---|---|
ReadOnlySpan<System.Char> | jsv |
Type Parameters
T
ToJson<T>(T, Action<Config>)
View Source
public static string ToJson<T>(this T obj, Action<Config> configure)
Returns
System.String
Parameters
Type | Name |
---|---|
<T> | obj |
System.Action<ServiceStack.Text.Config> | configure |
Type Parameters
T
ToJson<T>(T)
View Source
public static string ToJson<T>(this T obj)
Returns
System.String
Parameters
Type | Name |
---|---|
<T> | obj |
Type Parameters
T
ToSafeJson<T>(T)
View Source
public static string ToSafeJson<T>(this T obj)
Returns
System.String
Parameters
Type | Name |
---|---|
<T> | obj |
Type Parameters
T
FromJson<T>(String)
View Source
public static T FromJson<T>(this string json)
Returns
<T>
Parameters
Type | Name |
---|---|
System.String | json |
Type Parameters
T
FromJsonSpan<T>(ReadOnlySpan<Char>)
View Source
public static T FromJsonSpan<T>(this ReadOnlySpan<char> json)
Returns
<T>
Parameters
Type | Name |
---|---|
ReadOnlySpan<System.Char> | json |
Type Parameters
T
ToCsv<T>(T)
View Source
public static string ToCsv<T>(this T obj)
Returns
System.String
Parameters
Type | Name |
---|---|
<T> | obj |
Type Parameters
T
ToCsv<T>(T, Action<Config>)
View Source
public static string ToCsv<T>(this T obj, Action<Config> configure)
Returns
System.String
Parameters
Type | Name |
---|---|
<T> | obj |
System.Action<ServiceStack.Text.Config> | configure |
Type Parameters
T
FromCsv<T>(String)
View Source
public static T FromCsv<T>(this string csv)
Returns
<T>
Parameters
Type | Name |
---|---|
System.String | csv |
Type Parameters
T
FormatWith(String, Object[])
View Source
public static string FormatWith(this string text, params object[] args)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
System.Object[] | args |
Fmt(String, Object[])
View Source
public static string Fmt(this string text, params object[] args)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
System.Object[] | args |
Fmt(String, IFormatProvider, Object[])
View Source
public static string Fmt(this string text, IFormatProvider provider, params object[] args)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
System.IFormatProvider | provider |
System.Object[] | args |
Fmt(String, Object)
View Source
public static string Fmt(this string text, object arg1)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
System.Object | arg1 |
Fmt(String, Object, Object)
View Source
public static string Fmt(this string text, object arg1, object arg2)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
System.Object | arg1 |
System.Object | arg2 |
Fmt(String, Object, Object, Object)
View Source
public static string Fmt(this string text, object arg1, object arg2, object arg3)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
System.Object | arg1 |
System.Object | arg2 |
System.Object | arg3 |
StartsWithIgnoreCase(String, String)
View Source
public static bool StartsWithIgnoreCase(this string text, string startsWith)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | text |
System.String | startsWith |
EndsWithIgnoreCase(String, String)
View Source
public static bool EndsWithIgnoreCase(this string text, string endsWith)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | text |
System.String | endsWith |
ReadAllText(String)
View Source
public static string ReadAllText(this string filePath)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | filePath |
FileExists(String)
View Source
public static bool FileExists(this string filePath)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | filePath |
DirectoryExists(String)
View Source
public static bool DirectoryExists(this string dirPath)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | dirPath |
CreateDirectory(String)
View Source
public static void CreateDirectory(this string dirPath)
Parameters
Type | Name |
---|---|
System.String | dirPath |
IndexOfAny(String, String[])
View Source
public static int IndexOfAny(this string text, params string[] needles)
Returns
System.Int32
Parameters
Type | Name |
---|---|
System.String | text |
System.String[] | needles |
IndexOfAny(String, Int32, String[])
View Source
public static int IndexOfAny(this string text, int startIndex, params string[] needles)
Returns
System.Int32
Parameters
Type | Name |
---|---|
System.String | text |
System.Int32 | startIndex |
System.String[] | needles |
ExtractContents(String, String, String)
View Source
public static string ExtractContents(this string fromText, string startAfter, string endAt)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | fromText |
System.String | startAfter |
System.String | endAt |
ExtractContents(String, String, String, String)
View Source
public static string ExtractContents(this string fromText, string uniqueMarker, string startAfter, string endAt)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | fromText |
System.String | uniqueMarker |
System.String | startAfter |
System.String | endAt |
StripHtml(String)
View Source
public static string StripHtml(this string html)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | html |
Quoted(String)
View Source
public static string Quoted(this string text)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
StripQuotes(String)
View Source
public static string StripQuotes(this string text)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
StripMarkdownMarkup(String)
View Source
public static string StripMarkdownMarkup(this string markdown)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | markdown |
ToCamelCase(String)
View Source
public static string ToCamelCase(this string value)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | value |
ToPascalCase(String)
View Source
public static string ToPascalCase(this string value)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | value |
ToTitleCase(String)
View Source
public static string ToTitleCase(this string value)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | value |
ToLowercaseUnderscore(String)
View Source
public static string ToLowercaseUnderscore(this string value)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | value |
ToKebabCase(String)
View Source
public static string ToKebabCase(this string value)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | value |
ToLowerSafe(String)
View Source
public static string ToLowerSafe(this string value)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | value |
ToUpperSafe(String)
View Source
public static string ToUpperSafe(this string value)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | value |
SafeSubstring(String, Int32)
View Source
public static string SafeSubstring(this string value, int startIndex)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | value |
System.Int32 | startIndex |
SafeSubstring(String, Int32, Int32)
View Source
public static string SafeSubstring(this string value, int startIndex, int length)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | value |
System.Int32 | startIndex |
System.Int32 | length |
SubstringWithElipsis(String, Int32, Int32)
View Source
[Obsolete("typo")]
public static string SubstringWithElipsis(this string value, int startIndex, int length)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | value |
System.Int32 | startIndex |
System.Int32 | length |
SubstringWithEllipsis(String, Int32, Int32)
View Source
public static string SubstringWithEllipsis(this string value, int startIndex, int length)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | value |
System.Int32 | startIndex |
System.Int32 | length |
IsAnonymousType(Type)
View Source
public static bool IsAnonymousType(this Type type)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Type | type |
CompareIgnoreCase(String, String)
View Source
public static int CompareIgnoreCase(this string strA, string strB)
Returns
System.Int32
Parameters
Type | Name |
---|---|
System.String | strA |
System.String | strB |
EndsWithInvariant(String, String)
View Source
public static bool EndsWithInvariant(this string str, string endsWith)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | str |
System.String | endsWith |
ToEnum<T>(String)
View Source
public static T ToEnum<T>(this string value)
Returns
<T>
Parameters
Type | Name |
---|---|
System.String | value |
Type Parameters
T
ToEnumOrDefault<T>(String, T)
View Source
public static T ToEnumOrDefault<T>(this string value, T defaultValue)
Returns
<T>
Parameters
Type | Name |
---|---|
System.String | value |
<T> | defaultValue |
Type Parameters
T
SplitCamelCase(String)
View Source
public static string SplitCamelCase(this string value)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | value |
ToInvariantUpper(Char)
View Source
public static string ToInvariantUpper(this char value)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Char | value |
ToEnglish(String)
View Source
public static string ToEnglish(this string camelCase)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | camelCase |
ToHttps(String)
View Source
public static string ToHttps(this string url)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | url |
IsEmpty(String)
View Source
public static bool IsEmpty(this string value)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | value |
IsNullOrEmpty(String)
View Source
public static bool IsNullOrEmpty(this string value)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | value |
EqualsIgnoreCase(String, String)
View Source
public static bool EqualsIgnoreCase(this string value, string other)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | value |
System.String | other |
ReplaceFirst(String, String, String)
View Source
public static string ReplaceFirst(this string haystack, string needle, string replacement)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | haystack |
System.String | needle |
System.String | replacement |
ReplaceAll(String, String, String)
View Source
[Obsolete("Use built-in string.Replace()")]
public static string ReplaceAll(this string haystack, string needle, string replacement)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | haystack |
System.String | needle |
System.String | replacement |
ContainsAny(String, String[])
View Source
public static bool ContainsAny(this string text, params string[] testMatches)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | text |
System.String[] | testMatches |
ContainsAny(String, String[], StringComparison)
View Source
public static bool ContainsAny(this string text, string[] testMatches, StringComparison comparisonType)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | text |
System.String[] | testMatches |
System.StringComparison | comparisonType |
IsValidVarName(String)
View Source
public static bool IsValidVarName(this string name)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | name |
IsValidVarRef(String)
View Source
public static bool IsValidVarRef(this string name)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | name |
SafeVarName(String)
View Source
public static string SafeVarName(this string text)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
SafeVarRef(String)
View Source
public static string SafeVarRef(this string text)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
Join(List<String>)
View Source
public static string Join(this List<string> items)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Collections.Generic.List<System.String> | items |
Join(List<String>, String)
View Source
public static string Join(this List<string> items, string delimiter)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Collections.Generic.List<System.String> | items |
System.String | delimiter |
ToParentPath(String)
View Source
public static string ToParentPath(this string path)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | path |
RemoveCharFlags(String, Boolean[])
View Source
public static string RemoveCharFlags(this string text, bool[] charFlags)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
System.Boolean[] | charFlags |
ToNullIfEmpty(String)
View Source
public static string ToNullIfEmpty(this string text)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
IsUserType(Type)
View Source
public static bool IsUserType(this Type type)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Type | type |
IsUserEnum(Type)
View Source
public static bool IsUserEnum(this Type type)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Type | type |
IsSystemType(Type)
View Source
public static bool IsSystemType(this Type type)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Type | type |
IsTuple(Type)
View Source
public static bool IsTuple(this Type type)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Type | type |
IsInt(String)
View Source
public static bool IsInt(this string text)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | text |
ToInt(String)
View Source
public static int ToInt(this string text)
Returns
System.Int32
Parameters
Type | Name |
---|---|
System.String | text |
ToInt(String, Int32)
View Source
public static int ToInt(this string text, int defaultValue)
Returns
System.Int32
Parameters
Type | Name |
---|---|
System.String | text |
System.Int32 | defaultValue |
ToLong(String)
View Source
public static long ToLong(this string text)
Returns
System.Int64
Parameters
Type | Name |
---|---|
System.String | text |
ToInt64(String)
View Source
public static long ToInt64(this string text)
Returns
System.Int64
Parameters
Type | Name |
---|---|
System.String | text |
ToLong(String, Int64)
View Source
public static long ToLong(this string text, long defaultValue)
Returns
System.Int64
Parameters
Type | Name |
---|---|
System.String | text |
System.Int64 | defaultValue |
ToInt64(String, Int64)
View Source
public static long ToInt64(this string text, long defaultValue)
Returns
System.Int64
Parameters
Type | Name |
---|---|
System.String | text |
System.Int64 | defaultValue |
ToFloat(String)
View Source
public static float ToFloat(this string text)
Returns
System.Single
Parameters
Type | Name |
---|---|
System.String | text |
ToFloatInvariant(String)
View Source
public static float ToFloatInvariant(this string text)
Returns
System.Single
Parameters
Type | Name |
---|---|
System.String | text |
ToFloat(String, Single)
View Source
public static float ToFloat(this string text, float defaultValue)
Returns
System.Single
Parameters
Type | Name |
---|---|
System.String | text |
System.Single | defaultValue |
ToDouble(String)
View Source
public static double ToDouble(this string text)
Returns
System.Double
Parameters
Type | Name |
---|---|
System.String | text |
ToDoubleInvariant(String)
View Source
public static double ToDoubleInvariant(this string text)
Returns
System.Double
Parameters
Type | Name |
---|---|
System.String | text |
ToDouble(String, Double)
View Source
public static double ToDouble(this string text, double defaultValue)
Returns
System.Double
Parameters
Type | Name |
---|---|
System.String | text |
System.Double | defaultValue |
ToDecimal(String)
View Source
public static decimal ToDecimal(this string text)
Returns
System.Decimal
Parameters
Type | Name |
---|---|
System.String | text |
ToDecimalInvariant(String)
View Source
public static decimal ToDecimalInvariant(this string text)
Returns
System.Decimal
Parameters
Type | Name |
---|---|
System.String | text |
ToDecimal(String, Decimal)
View Source
public static decimal ToDecimal(this string text, decimal defaultValue)
Returns
System.Decimal
Parameters
Type | Name |
---|---|
System.String | text |
System.Decimal | defaultValue |
Matches(String, String)
View Source
public static bool Matches(this string value, string pattern)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | value |
System.String | pattern |
Glob(String, String)
View Source
public static bool Glob(this string value, string pattern)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | value |
System.String | pattern |
GlobPath(String, String)
View Source
public static bool GlobPath(this string filePath, string pattern)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | filePath |
System.String | pattern |
TrimPrefixes(String, String[])
View Source
public static string TrimPrefixes(this string fromString, params string[] prefixes)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | fromString |
System.String[] | prefixes |
FromAsciiBytes(Byte[])
View Source
public static string FromAsciiBytes(this byte[] bytes)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Byte[] | bytes |
ToAsciiBytes(String)
View Source
public static byte[] ToAsciiBytes(this string value)
Returns
System.Byte[]
Parameters
Type | Name |
---|---|
System.String | value |
ParseKeyValueText(String, String)
View Source
public static Dictionary<string, string> ParseKeyValueText(this string text, string delimiter = " ")
Returns
System.Collections.Generic.Dictionary<System.String,System.String>
Parameters
Type | Name |
---|---|
System.String | text |
System.String | delimiter |
ParseAsKeyValues(String, String)
View Source
public static List<KeyValuePair<string, string>> ParseAsKeyValues(this string text, string delimiter = " ")
Returns
System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String,System.String>>
Parameters
Type | Name |
---|---|
System.String | text |
System.String | delimiter |
ReadLines(String)
View Source
public static IEnumerable<string> ReadLines(this string text)
Returns
System.Collections.Generic.IEnumerable<System.String>
Parameters
Type | Name |
---|---|
System.String | text |
CountOccurrencesOf(String, Char)
View Source
public static int CountOccurrencesOf(this string text, char needle)
Returns
System.Int32
Parameters
Type | Name |
---|---|
System.String | text |
System.Char | needle |
NormalizeNewLines(String)
View Source
public static string NormalizeNewLines(this string text)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
HexEscape(String, Char[])
View Source
public static string HexEscape(this string text, params char[] anyCharOf)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
System.Char[] | anyCharOf |
ToXml<T>(T)
View Source
public static string ToXml<T>(this T obj)
Returns
System.String
Parameters
Type | Name |
---|---|
<T> | obj |
Type Parameters
T
FromXml<T>(String)
View Source
public static T FromXml<T>(this string json)
Returns
<T>
Parameters
Type | Name |
---|---|
System.String | json |
Type Parameters
T
ToHex(Byte[], Boolean)
View Source
public static string ToHex(this byte[] hashBytes, bool upper = false)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Byte[] | hashBytes |
System.Boolean | upper |