Skip to main content

TextUtils

Assembly: ServiceStack.Blazor.dll
View Source
Declaration
public static class TextUtils

Properties

UseCulture

View Source
Declaration
public static CultureInfo UseCulture { get; set; }

FormatString

View Source
Declaration
public static Func<string, string> FormatString { get; set; }

FormatCurrency

View Source
Declaration
public static Func<decimal, string> FormatCurrency { get; set; }

FormatDate

View Source
Declaration
public static Func<DateTime, string> FormatDate { get; set; }

FormatTime

View Source
Declaration
public static Func<TimeSpan, string> FormatTime { get; set; }

Fields

ByteSizes

View Source
Declaration
public static string[] ByteSizes

Methods

DefaultFormatString(String)

View Source
Declaration
public static string DefaultFormatString(string value)
Returns

System.String

Parameters
TypeName
System.Stringvalue

DefaultFormatCurrency(Decimal)

View Source
Declaration
public static string DefaultFormatCurrency(decimal value)
Returns

System.String

Parameters
TypeName
System.Decimalvalue

DefaultFormatDate(DateTime)

View Source
Declaration
public static string DefaultFormatDate(DateTime value)
Returns

System.String

Parameters
TypeName
DateTimevalue

FormatIso8601Date(DateTime)

View Source
Declaration
public static string FormatIso8601Date(DateTime value)
Returns

System.String

Parameters
TypeName
DateTimevalue

DefaultFormatTime(TimeSpan)

View Source
Declaration
public static string DefaultFormatTime(TimeSpan value)
Returns

System.String

Parameters
TypeName
TimeSpanvalue

ConvertTo<T>(Object)

View Source
Declaration
public static T ConvertTo<T>(object from)
Returns

<T>

Parameters
TypeName
System.Objectfrom
Type Parameters
  • T

ConvertTo(Object, Type)

View Source
Declaration
public static object ConvertTo(object from, Type toType)
Returns

System.Object

Parameters
TypeName
System.Objectfrom
TypetoType

FormatDateObject(Object)

View Source
Declaration
public static string FormatDateObject(object o)
Returns

System.String

Parameters
TypeName
System.Objecto

SplitCase(String)

View Source
Declaration
public static string SplitCase(string text)
Returns

System.String

Parameters
TypeName
System.Stringtext

Humanize(String)

View Source
Declaration
public static string Humanize(string text)
Returns

System.String

Parameters
TypeName
System.Stringtext

TitleCase(String)

View Source
Declaration
public static string TitleCase(string text)
Returns

System.String

Parameters
TypeName
System.Stringtext

PascalCase(String)

View Source
Declaration
public static string PascalCase(string text)
Returns

System.String

Parameters
TypeName
System.Stringtext

CamelCase(String)

View Source
Declaration
public static string CamelCase(string text)
Returns

System.String

Parameters
TypeName
System.Stringtext

SnakeCase(String)

View Source
Declaration
public static string SnakeCase(string text)
Returns

System.String

Parameters
TypeName
System.Stringtext

KebabCase(String)

View Source
Declaration
public static string KebabCase(string text)
Returns

System.String

Parameters
TypeName
System.Stringtext

StyleText(String, TextStyle)

View Source
Declaration
public static string StyleText(string text, TextStyle textStyle)
Returns

System.String

Parameters
TypeName
System.Stringtext
ServiceStack.Blazor.TextStyletextStyle

ToKeyValuePairs(IEnumerable)

View Source
Declaration
public static List<KeyValuePair<string, string>> ToKeyValuePairs(IEnumerable values)
Returns

List<KeyValuePair<System.String,System.String>>

Parameters
TypeName
System.Collections.IEnumerablevalues

TextList(IEnumerable, TextDumpOptions)

View Source
Declaration
public static string TextList(IEnumerable items, TextDumpOptions options)
Returns

System.String

Parameters
TypeName
System.Collections.IEnumerableitems
ServiceStack.Blazor.TextDumpOptionsoptions

TextDump(Object, TextDumpOptions)

View Source
Declaration
public static string TextDump(object target, TextDumpOptions options)
Returns

System.String

Parameters
TypeName
System.Objecttarget
ServiceStack.Blazor.TextDumpOptionsoptions

GetScalarText(Object)

View Source
Declaration
public static string GetScalarText(object value)
Returns

System.String

Parameters
TypeName
System.Objectvalue

IsComplexType(Nullable<Type>)

View Source
Declaration
public static bool IsComplexType(this Type? type)
Returns

System.Boolean

Parameters
TypeName
System.Nullable<Type>type

IsComputed(PropertyInfo)

View Source
Declaration
public static bool IsComputed(this PropertyInfo prop)
Returns

System.Boolean

Parameters
TypeName
System.Reflection.PropertyInfoprop

AllKeysWithDefaultValues(IEnumerable)

View Source
Declaration
public static List<string> AllKeysWithDefaultValues(IEnumerable collection)
Returns

List<System.String>

Parameters
TypeName
System.Collections.IEnumerablecollection

IIF<T>(Boolean, T)

View Source
Declaration
public static T IIF<T>(bool test, T ifTrue)
Returns

<T>

Parameters
TypeName
System.Booleantest
<T>ifTrue
Type Parameters
  • T

IIF<T>(Boolean, T, T)

View Source
Declaration
public static T IIF<T>(bool test, T ifTrue, T ifFalse)
Returns

<T>

Parameters
TypeName
System.Booleantest
<T>ifTrue
<T>ifFalse
Type Parameters
  • T

Get(Nullable<Dictionary<String, Object>>, String)

View Source
Declaration
public static object Get(this Dictionary<string, object>? o, string name)
Returns

System.Object

Parameters
TypeName
System.Nullable<Dictionary<System.String,System.Object>>o
System.Stringname

IsNullOrWhiteSpace(Nullable<Dictionary<String, Object>>, String)

View Source
Declaration
public static bool IsNullOrWhiteSpace(this Dictionary<string, object>? o, string name)
Returns

System.Boolean

Parameters
TypeName
System.Nullable<Dictionary<System.String,System.Object>>o
System.Stringname

Prepend<T>(List<T>, T)

View Source
Declaration
public static List<T> Prepend<T>(this List<T> list, T item)
Returns

List<<T>>

Parameters
TypeName
List<<T>>list
<T>item
Type Parameters
  • T

Append<T>(List<T>, T)

View Source
Declaration
public static List<T> Append<T>(this List<T> list, T item)
Returns

List<<T>>

Parameters
TypeName
List<<T>>list
<T>item
Type Parameters
  • T

ToModelString(Object)

View Source
Declaration
public static string ToModelString(this object from)
Returns

System.String

Parameters
TypeName
System.Objectfrom

ToModelStrings(Object)

View Source
Declaration
public static List<string>? ToModelStrings(this object from)
Returns

System.Nullable<List<System.String>>

Parameters
TypeName
System.Objectfrom

ToModelDictionary<T>(T)

Used to convert Typed model into an object dictionary for usage in DynamicInput

View Source
Declaration
public static Dictionary<string, object> ToModelDictionary<T>(this T from)
Returns

Dictionary<System.String,System.Object>

Parameters
TypeName
<T>from
Type Parameters
  • T

FromModelDictionary<T>(Dictionary<String, Object>)

Used to convert DynamicInput dictionary to a Typed model

View Source
Declaration
public static T FromModelDictionary<T>(this Dictionary<string, object> from)
Returns

<T>

Parameters
TypeName
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
Declaration
public static object FromModelDictionary(this Dictionary<string, object> from, Type type)
Returns

System.Object

Parameters
TypeName
Dictionary<System.String,System.Object>from
Typetype

CreateFormLayout<T>(MetadataType)

Create a Form Layout from a declarative annotated DTO definition

View Source
Declaration
public static List<InputInfo> CreateFormLayout<T>(this MetadataType metadataType)
Returns

List<ServiceStack.InputInfo>

Parameters
TypeName
ServiceStack.MetadataTypemetadataType
Type Parameters
  • T

CreateFormLayout(MetadataType, Type)

View Source
Declaration
public static List<InputInfo> CreateFormLayout(this MetadataType metadataType, Type type)
Returns

List<ServiceStack.InputInfo>

Parameters
TypeName
ServiceStack.MetadataTypemetadataType
Typetype

CreateFormLayout(MetadataType, Type, AppMetadata)

View Source
Declaration
public static List<InputInfo> CreateFormLayout(this MetadataType metadataType, Type type, AppMetadata appMetadata)
Returns

List<ServiceStack.InputInfo>

Parameters
TypeName
ServiceStack.MetadataTypemetadataType
Typetype
ServiceStack.AppMetadataappMetadata

Truncate(String, Int32)

View Source
Declaration
public static string Truncate(string str, int maxLength)
Returns

System.String

Parameters
TypeName
System.Stringstr
System.Int32maxLength

TruncateJson(String, Int32)

View Source
Declaration
public static string TruncateJson(string json, int maxLength)
Returns

System.String

Parameters
TypeName
System.Stringjson
System.Int32maxLength

FirstOrDefault(IEnumerable)

View Source
Declaration
public static object FirstOrDefault(IEnumerable items)
Returns

System.Object

Parameters
TypeName
System.Collections.IEnumerableitems

FormatJson(Object)

View Source
Declaration
public static string FormatJson(object o)
Returns

System.String

Parameters
TypeName
System.Objecto

Dump(Object)

View Source
Declaration
public static string Dump(object o)
Returns

System.String

Parameters
TypeName
System.Objecto

Pluralize<T>(String, Nullable<ICollection<T>>)

View Source
Declaration
public static string Pluralize<T>(string word, ICollection<T>? collection)
Returns

System.String

Parameters
TypeName
System.Stringword
System.Nullable<System.Collections.ICollection<<T>>>collection
Type Parameters
  • T

Pluralize(String, Int32)

View Source
Declaration
public static string Pluralize(string word, int count)
Returns

System.String

Parameters
TypeName
System.Stringword
System.Int32count

FormatBytes(Int64, Int32)

View Source
Declaration
public static string FormatBytes(long bytes, int decimals = 2)
Returns

System.String

Parameters
TypeName
System.Int64bytes
System.Int32decimals