TextUtils
Assembly: ServiceStack.Blazor.dll
View Source
public static class TextUtils
Properties
UseCulture
View Source
public static CultureInfo UseCulture { get; set; }
FormatString
View Source
public static Func<string, string> FormatString { get; set; }
FormatCurrency
View Source
public static Func<decimal, string> FormatCurrency { get; set; }
FormatDate
View Source
public static Func<DateTime, string> FormatDate { get; set; }
FormatTime
View Source
public static Func<TimeSpan, string> FormatTime { get; set; }
Fields
ByteSizes
View Source
public static string[] ByteSizes
Methods
DefaultFormatString(String)
View Source
public static string DefaultFormatString(string value)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | value |
DefaultFormatCurrency(Decimal)
View Source
public static string DefaultFormatCurrency(decimal value)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Decimal | value |
DefaultFormatDate(DateTime)
View Source
public static string DefaultFormatDate(DateTime value)
Returns
System.String
Parameters
Type | Name |
---|---|
DateTime | value |
FormatIso8601Date(DateTime)
View Source
public static string FormatIso8601Date(DateTime value)
Returns
System.String
Parameters
Type | Name |
---|---|
DateTime | value |
DefaultFormatTime(TimeSpan)
View Source
public static string DefaultFormatTime(TimeSpan value)
Returns
System.String
Parameters
Type | Name |
---|---|
TimeSpan | value |
ConvertTo<T>(Object)
View Source
public static T ConvertTo<T>(object from)
Returns
<T>
Parameters
Type | Name |
---|---|
System.Object | from |
Type Parameters
T
ConvertTo(Object, Type)
View Source
public static object ConvertTo(object from, Type toType)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.Object | from |
Type | toType |
FormatDateObject(Object)
View Source
public static string FormatDateObject(object o)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Object | o |
SplitCase(String)
View Source
public static string SplitCase(string text)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
Humanize(String)
View Source
public static string Humanize(string text)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
TitleCase(String)
View Source
public static string TitleCase(string text)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
PascalCase(String)
View Source
public static string PascalCase(string text)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
CamelCase(String)
View Source
public static string CamelCase(string text)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
SnakeCase(String)
View Source
public static string SnakeCase(string text)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
KebabCase(String)
View Source
public static string KebabCase(string text)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
StyleText(String, TextStyle)
View Source
public static string StyleText(string text, TextStyle textStyle)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
ServiceStack.Blazor.TextStyle | textStyle |
ToKeyValuePairs(IEnumerable)
View Source
public static List<KeyValuePair<string, string>> ToKeyValuePairs(IEnumerable values)
Returns
List<KeyValuePair<System.String,System.String>>
Parameters
Type | Name |
---|---|
System.Collections.IEnumerable | values |
TextList(IEnumerable, TextDumpOptions)
View Source
public static string TextList(IEnumerable items, TextDumpOptions options)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Collections.IEnumerable | items |
ServiceStack.Blazor.TextDumpOptions | options |
TextDump(Object, TextDumpOptions)
View Source
public static string TextDump(object target, TextDumpOptions options)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Object | target |
ServiceStack.Blazor.TextDumpOptions | options |
GetScalarText(Object)
View Source
public static string GetScalarText(object value)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Object | value |
IsComplexType(Nullable<Type>)
View Source
public static bool IsComplexType(this Type? type)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Nullable<Type> | type |
IsComputed(PropertyInfo)
View Source
public static bool IsComputed(this PropertyInfo prop)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Reflection.PropertyInfo | prop |
AllKeysWithDefaultValues(IEnumerable)
View Source
public static List<string> AllKeysWithDefaultValues(IEnumerable collection)
Returns
List<System.String>
Parameters
Type | Name |
---|---|
System.Collections.IEnumerable | collection |
IIF<T>(Boolean, T)
View Source
public static T IIF<T>(bool test, T ifTrue)
Returns
<T>
Parameters
Type | Name |
---|---|
System.Boolean | test |
<T> | ifTrue |
Type Parameters
T
IIF<T>(Boolean, T, T)
View Source
public static T IIF<T>(bool test, T ifTrue, T ifFalse)
Returns
<T>
Parameters
Type | Name |
---|---|
System.Boolean | test |
<T> | ifTrue |
<T> | ifFalse |
Type Parameters
T
Get(Nullable<Dictionary<String, Object>>, String)
View Source
public static object Get(this Dictionary<string, object>? o, string name)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.Nullable<Dictionary<System.String,System.Object>> | o |
System.String | name |
IsNullOrWhiteSpace(Nullable<Dictionary<String, Object>>, String)
View Source
public static bool IsNullOrWhiteSpace(this Dictionary<string, object>? o, string name)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Nullable<Dictionary<System.String,System.Object>> | o |
System.String | name |
Prepend<T>(List<T>, T)
View Source
public static List<T> Prepend<T>(this List<T> list, T item)
Returns
List<<T>>
Parameters
Type | Name |
---|---|
List<<T>> | list |
<T> | item |
Type Parameters
T
Append<T>(List<T>, T)
View Source
public static List<T> Append<T>(this List<T> list, T item)
Returns
List<<T>>
Parameters
Type | Name |
---|---|
List<<T>> | list |
<T> | item |
Type Parameters
T
ToModelString(Object)
View Source
public static string ToModelString(this object from)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Object | from |
ToModelStrings(Object)
View Source
public static List<string>? ToModelStrings(this object from)
Returns
System.Nullable<List<System.String>>
Parameters
Type | Name |
---|---|
System.Object | from |
ToModelDictionary<T>(T)
Used to convert Typed model into an object dictionary for usage in DynamicInput
View Source
public static Dictionary<string, object> ToModelDictionary<T>(this T from)
Returns
Dictionary<System.String,System.Object>
Parameters
Type | Name |
---|---|
<T> | from |
Type Parameters
T
FromModelDictionary<T>(Dictionary<String, Object>)
Used to convert DynamicInput dictionary to a Typed model
View Source
public static T FromModelDictionary<T>(this Dictionary<string, object> from)
Returns
<T>
Parameters
Type | Name |
---|---|
Dictionary<System.String,System.Object> | from |
Type Parameters
T
FromModelDictionary(Dictionary<String, Object>, Type)
Used to convert DynamicInput dictionary to a Typed model
View Source
public static object FromModelDictionary(this Dictionary<string, object> from, Type type)
Returns
System.Object
Parameters
Type | Name |
---|---|
Dictionary<System.String,System.Object> | from |
Type | type |
CreateFormLayout<T>(MetadataType)
Create a Form Layout from a declarative annotated DTO definition
View Source
public static List<InputInfo> CreateFormLayout<T>(this MetadataType metadataType)
Returns
List<ServiceStack.InputInfo>
Parameters
Type | Name |
---|---|
ServiceStack.MetadataType | metadataType |
Type Parameters
T
CreateFormLayout(MetadataType, Type)
View Source
public static List<InputInfo> CreateFormLayout(this MetadataType metadataType, Type type)
Returns
List<ServiceStack.InputInfo>
Parameters
Type | Name |
---|---|
ServiceStack.MetadataType | metadataType |
Type | type |
CreateFormLayout(MetadataType, Type, AppMetadata)
View Source
public static List<InputInfo> CreateFormLayout(this MetadataType metadataType, Type type, AppMetadata appMetadata)
Returns
List<ServiceStack.InputInfo>
Parameters
Type | Name |
---|---|
ServiceStack.MetadataType | metadataType |
Type | type |
ServiceStack.AppMetadata | appMetadata |
Truncate(String, Int32)
View Source
public static string Truncate(string str, int maxLength)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | str |
System.Int32 | maxLength |
TruncateJson(String, Int32)
View Source
public static string TruncateJson(string json, int maxLength)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | json |
System.Int32 | maxLength |
FirstOrDefault(IEnumerable)
View Source
public static object FirstOrDefault(IEnumerable items)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.Collections.IEnumerable | items |
FormatJson(Object)
View Source
public static string FormatJson(object o)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Object | o |
Dump(Object)
View Source
public static string Dump(object o)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Object | o |
Pluralize<T>(String, Nullable<ICollection<T>>)
View Source
public static string Pluralize<T>(string word, ICollection<T>? collection)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | word |
System.Nullable<System.Collections.ICollection<<T>>> | collection |
Type Parameters
T
Pluralize(String, Int32)
View Source
public static string Pluralize(string word, int count)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | word |
System.Int32 | count |
FormatBytes(Int64, Int32)
View Source
public static string FormatBytes(long bytes, int decimals = 2)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Int64 | bytes |
System.Int32 | decimals |