DEV Community

Cover image for Nomus: String Normalization in .NET
Juan Fernando Alzate
Juan Fernando Alzate

Posted on

Nomus: String Normalization in .NET

When you work simultaneously with APIs, databases, and frontend applications, it’s almost inevitable to run into inconsistencies in naming conventions. In the modern .NET development ecosystem, where multiple layers and systems with different rules coexist, what may seem like a minor detail to the team often becomes a constant source of friction within the code.

That’s where packages like Nomus come into play.

In this article, I’ll show you how to install the Nomus package in .NET and how to implement it with a practical example — but before we begin, let’s define:

What is Nomus?

It’s a NuGet package designed for applications in .NET 8.0 and above, aimed at simplifying string normalization and conversion between different casing styles.

What problem does it solve?

When working with multiple systems, it’s common to encounter different naming formats:

  • APIs that use camelCase
  • Databases with snake_case
  • Classes in PascalCase
  • URLs in kebab-case

Without the right tool, you end up writing manual logic for each case — which not only takes time but also introduces inconsistencies.

Nomus eliminates this problem with a simple and straightforward API.

Key Features

Detect: Automatically detects the original text format (UpperCase, PascalCase, TrainCase, etc).

Convert: Easily converts text between multiple formats in an intuitive way:

  • PascalCase → HolaMundo
  • camelCase → holaMundo
  • kebab-case → hola-mundo
  • snake_case → hola_mundo
  • Title Case → Hola Mundo

All of this in a single line of code, without the need for complex regular expressions or custom logic.

Let’s Get Started

Installation:
Option 1: From Visual Studio, right-click on the project name, select Manage NuGet Packages → Browse → Nomus

option 1

Option 2: From the console:

dotnet add package Devjavu.Nomus
Enter fullscreen mode Exit fullscreen mode

Implementation

Quick usage:

using Nomus;

// Detect naming style
var detected = Naming.DetectNamingStyle("votesUsers");
// "camelCase"

// PascalCase
var p = Naming.ToPascalCase("user_votes_details");
// UserVotesDetails

// camelCase
var c = Naming.ToCamelCase("UserVotesDetails");
// userVotesDetails

// snake_case
var s = Naming.ToSnakeCase("userVotesDetails");
// user_votes_details

// kebab-case
var k = Naming.ToKebabCase("userVotesDetails");
// user-votes-details
Enter fullscreen mode Exit fullscreen mode

Practical Example

Suppose we have this model:

public class UserDto
{
    public string FullName { get; set; }
    public string RegistrationDate { get; set; }
}
Enter fullscreen mode Exit fullscreen mode

By default, ASP.NET Core already converts to camelCase, but if you need full control or custom formats, you can use Nomus.

Let's transform the model with Nomus:

using Devjavu.Nomus;

var data = new Dictionary<string, object>()
{
    { "FullName", "Jhon Alzate" },
    { "RegistrationDate", "2026-01-01" }
};

var transformed = data.ToDictionary(
    key => Nomus.ToCamelCase(key.Key),
    value => value.Value
);
Enter fullscreen mode Exit fullscreen mode

Result:

{
  "fullName": "Jhon Alzate",
  "registrationDate": "2026-01-01"
}
Enter fullscreen mode Exit fullscreen mode

We can go further and create a reusable helper:

public static class NomusExtensions
{
    public static Dictionary<string, object> ToCamelCaseKeys(this object obj)
    {
        var dict = obj.GetType()
            .GetProperties()
            .ToDictionary(
                prop => Nomus.ToCamelCase(prop.Name),
                prop => prop.GetValue(obj)
            );

        return dict;
    }
}
Enter fullscreen mode Exit fullscreen mode

Usage:

var usuario = new UsuarioDto
{
    FullName = "Jhon Alzate",
    RegistrationDate = "2026-01-01"
};

var response = usuario.ToCamelCaseKeys();
Enter fullscreen mode Exit fullscreen mode

Bonus: generate URL Slugs

You can use Nomus for SEO or clean routes:

string title = ".NET Course for Beginners";
string slug = Nomus.ToKebabCase(titulo);

// result: "net-course-for-beginners"
Enter fullscreen mode Exit fullscreen mode

Why use Nomus?

Because it allows you to:

  • Reduce repetitive code
  • Avoid errors in manual conversions
  • Maintain consistency in your project
  • Improve code readability

And most importantly: focus on business logic, not string manipulation.

Conclusion

Nomus is a lightweight yet powerful tool that solves a common problem in software development. If you work with multiple naming formats in .NET, this package can save you time and headaches.

Top comments (0)