Skip to content

Class StringExtensions ​

Namespace: Momentum.Extensions.Abstractions.Extensions
Assembly: Momentum.Extensions.Abstractions.dll

Provides extension methods for string manipulation and case conversion.

csharp
public static class StringExtensions

Inheritance ​

object ← StringExtensions

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.

csharp
public static string ToKebabCase(this string input)

Parameters ​

input string

The string to convert.

Returns ​

string

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.

csharp
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 ​

string

The string converted to lowercase with separators.

ToSnakeCase(string) ​

Converts a string to snake_case format.

csharp
public static string ToSnakeCase(this string input)

Parameters ​

input string

The string to convert.

Returns ​

string

The string converted to snake_case.

Examples ​

"HelloWorld" becomes "hello_world" "APIName" becomes "api_name" "IOController" becomes "io_controller"