Class StringExtensions
Namespace: Momentum.Extensions.Abstractions.Extensions
Assembly: Momentum.Extensions.Abstractions.dll
Provides extension methods for string manipulation and case conversion.
public static class StringExtensions
Inheritance
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Methods
ToKebabCase(string)
Converts a string to kebab-case format.
public static string ToKebabCase(this string input)
Parameters
input
string
The string to convert.
Returns
The string converted to kebab-case.
Examples
"HelloWorld" becomes "hello-world" "APIName" becomes "api-name" "IOController" becomes "io-controller"
ToLowerCaseWithSeparator(string, char)
Converts a camelCase/PascalCase string to a lowercase with a specified separator between words.
public static string ToLowerCaseWithSeparator(this string input, char separator)
Parameters
input
string
The string.
separator
char
The character to use as a separator between words.
Returns
The string converted to lowercase with separators.
ToSnakeCase(string)
Converts a string to snake_case format.
public static string ToSnakeCase(this string input)
Parameters
input
string
The string to convert.
Returns
The string converted to snake_case.
Examples
"HelloWorld" becomes "hello_world" "APIName" becomes "api_name" "IOController" becomes "io_controller"