Skip to main content

StringUtils

Assembly: ServiceStack.Common.dll
View Source
Declaration
public static class StringUtils

Fields

EscapedCharMap

View Source
Declaration
public static readonly Dictionary<char, string> EscapedCharMap

NewLineMemory

View Source
Declaration
public static ReadOnlyMemory<char> NewLineMemory

HtmlCharacterCodes

View Source
Declaration
public static readonly IDictionary<string, string> HtmlCharacterCodes

Methods

ParseCommands(String)

View Source
Declaration
public static List<Command> ParseCommands(this string commandsString)
Returns

System.Collections.Generic.List<ServiceStack.Command>

Parameters
TypeName
System.StringcommandsString

ParseCommands(ReadOnlyMemory<Char>, Char)

View Source
Declaration
public static List<Command> ParseCommands(this ReadOnlyMemory<char> commandsString, char separator = ',')
Returns

System.Collections.Generic.List<ServiceStack.Command>

Parameters
TypeName
ReadOnlyMemory<System.Char>commandsString
System.Charseparator

ParseArguments(ReadOnlyMemory<Char>, out List<ReadOnlyMemory<Char>>)

View Source
Declaration
public static ReadOnlyMemory<char> ParseArguments(ReadOnlyMemory<char> argsString, out List<ReadOnlyMemory<char>> args)
Returns

ReadOnlyMemory<System.Char>

Parameters
TypeName
ReadOnlyMemory<System.Char>argsString
System.Collections.Generic.List<ReadOnlyMemory<System.Char>>args

ReplacePairs(String, String[])

Multiple string replacements

View Source
Declaration
public static string ReplacePairs(string str, string[] replaceStringsPairs)
Returns

System.String

Parameters
TypeNameDescription
System.Stringstr

| | System.String[] | replaceStringsPairs | Even number of old and new value pairs

|

ReplaceOutsideOfQuotes(String, String[])

Replace string contents outside of string quotes

View Source
Declaration
public static string ReplaceOutsideOfQuotes(this string str, params string[] replaceStringsPairs)
Returns

System.String

Parameters
TypeName
System.Stringstr
System.String[]replaceStringsPairs

SafeInput(String)

Protect against XSS by cleaning non-standard User Input

View Source
Declaration
public static string SafeInput(this string text)
Returns

System.String

Parameters
TypeName
System.Stringtext

ToEscapedString(String)

View Source
Declaration
public static string ToEscapedString(this string input)
Returns

System.String

Parameters
TypeName
System.Stringinput

SnakeCaseToPascalCase(String)

View Source
Declaration
public static string SnakeCaseToPascalCase(string snakeCase)
Returns

System.String

Parameters
TypeName
System.StringsnakeCase

RemoveSuffix(String, String)

View Source
Declaration
public static string RemoveSuffix(string name, string suffix)
Returns

System.String

Parameters
TypeName
System.Stringname
System.Stringsuffix

HtmlEncodeLite(String)

View Source
Declaration
public static string HtmlEncodeLite(this string html)
Returns

System.String

Parameters
TypeName
System.Stringhtml

HtmlEncode(String)

View Source
Declaration
public static string HtmlEncode(this string html)
Returns

System.String

Parameters
TypeName
System.Stringhtml

HtmlDecode(String)

View Source
Declaration
public static string HtmlDecode(this string html)
Returns

System.String

Parameters
TypeName
System.Stringhtml

ConvertHtmlCodes(String)

View Source
Declaration
public static string ConvertHtmlCodes(this string html)
Returns

System.String

Parameters
TypeName
System.Stringhtml

ToChar(Int32)

View Source
Declaration
public static string ToChar(this int codePoint)
Returns

System.String

Parameters
TypeName
System.Int32codePoint

SplitVarNames(String)

View Source
Declaration
public static string[] SplitVarNames(string fields)
Returns

System.String[]

Parameters
TypeName
System.Stringfields

SplitGenericArgs(String)

View Source
Declaration
public static List<string> SplitGenericArgs(string argList)
Returns

System.Collections.Generic.List<System.String>

Parameters
TypeName
System.StringargList

ParseTypeIntoNodes(String)

View Source
Declaration
public static TextNode ParseTypeIntoNodes(this string typeDef)
Returns

ServiceStack.TextNode

Parameters
TypeName
System.StringtypeDef

ParseTypeIntoNodes(String, Char[])

View Source
Declaration
public static TextNode ParseTypeIntoNodes(this string typeDef, char[] genericDelimChars)
Returns

ServiceStack.TextNode

Parameters
TypeName
System.StringtypeDef
System.Char[]genericDelimChars

AppendLine(StringBuilder, ReadOnlyMemory<Char>)

View Source
Declaration
public static void AppendLine(this StringBuilder sb, ReadOnlyMemory<char> line)
Parameters
TypeName
System.Text.StringBuildersb
ReadOnlyMemory<System.Char>line