Class StringExtensions
- Namespace
- GroupeIsa.Neos.Shared.Extensions
- Assembly
- GroupeIsa.Neos.Shared.dll
Extensions methods of the type string.
public static class StringExtensions
- Inheritance
-
StringExtensions
- Inherited Members
Methods
IsCamelCase(string)
Indicates whether the string is in camel case.
public static bool IsCamelCase(this string source)
Parameters
source
stringA string.
Returns
- bool
True if the string is in camel case; otherwise, false.
IsLower(string)
Indicates whether the string is lowercase.
public static bool IsLower(this string source)
Parameters
source
stringA string.
Returns
- bool
True if the string is lowercase; otherwise, false.
Remarks
Consider string to be lowercase if it has no uppercase letters.
IsPascalCase(string)
Indicates whether the string is in pascal case.
public static bool IsPascalCase(this string source)
Parameters
source
stringA string.
Returns
- bool
True if the string is in pascal case; otherwise, false.
IsUpper(string)
Indicates whether the string is uppercase.
public static bool IsUpper(this string source)
Parameters
source
stringA string.
Returns
- bool
True if the string is uppercase; otherwise, false.
Remarks
Consider string to be uppercase if it has no lowercase letters.
SplitLines(string)
Splits string into lines regardless of the newline character (CRLF, LF, CR).
public static string[] SplitLines(this string source)
Parameters
source
stringThe string to split into lines.
Returns
- string[]
The lines.
ToCamelCase(string)
Converts a string to camelCase.
public static string ToCamelCase(this string source)
Parameters
source
stringA string.
Returns
- string
The changed string.
Remarks
Same implementation as Newtonsoft.JSON in order to have the same output when generating JSON or using this method. See https://github.com/JamesNK/Newtonsoft.Json/blob/666d9760719e5ec5b2a50046f7dbd6a1267c01c6/Src/Newtonsoft.Json/Utilities/StringUtils.cs#L155. "Entity" becomes "entity". "TwoWords" becomes "twoWords". "UIView" becomes "uiView". "Entity.Name" becomes "entity.name".
ToCapitalizeFirstLetter(string)
Capitalizes the first letter of the specified string.
public static string ToCapitalizeFirstLetter(this string source)
Parameters
source
stringA string.
Returns
- string
The changed string.
ToKebabCase(string)
Converts a string to kebab-case.
public static string ToKebabCase(this string source)
Parameters
source
stringString to convert.
Returns
- string
Converted string.
ToLocalizableString(string, char, char, char)
Converts to a localizable string a list of strings each representing a key-value pair that are concatenated using a delimiter character.
public static LocalizableString ToLocalizableString(this string source, char keyValueDelimiter, char delimiter, char escape = '\\')
Parameters
source
stringList of concatenated key-value pair strings joined by a delimiter character. This format can be obtained when using ToString(IEnumerable<string>, char, char).
keyValueDelimiter
charCharacter delimiting a key-value pair.
delimiter
charCharacter delimiting key-value pair string.
escape
charEscape character.
Returns
- LocalizableString
Unescaped, split strings.
ToPascalCase(string)
Converts a string to PascalCase.
public static string ToPascalCase(this string source)
Parameters
source
stringA string.
Returns
- string
The changed string.
ToString(IEnumerable<string>, char, char)
Joins multiple strings using a delimitation character and escapes any occurrence of the delimitation character in said strings by using an escape character.
public static string ToString(this IEnumerable<string> strings, char delimiter, char escape = '\\')
Parameters
strings
IEnumerable<string>Strings to join.
delimiter
charDelimiter character.
escape
charEscape character.
Returns
- string
Joined string.
ToStringArray(string, char, char)
Split strings delimited strings, respecting if the delimiter characters is escaped.
public static string[] ToStringArray(this string source, char delimiter, char escape = '\\')
Parameters
source
stringJoined string from ToString(IEnumerable<string>, char, char).
delimiter
charDelimiter character.
escape
charEscape character.
Returns
- string[]
Unescaped, split strings.