CommunityToolkit / CommunityToolkit/dotnet

Provide "prettification" extension method FirstToUpper for string

Open
#661 0 comments 0 reactions 0 assignees View on GitHub
feature request :mailbox_with_mail:
Dominant language
C#
Stars
3.8k
Forks
400
PR merge metrics
No merged PRs in 30d

Description

### Overview

Hello, here is another entry of my proposals for functionalities to import from my current CommonNET project to the Microsoft Community Toolkit, I hope you find it useful (and if not, nothing happens). Thanks in any case :)

In case you need to prettify a string for some reason, and you can't be sure about how the string currently will be received, this methods can help to format them appropriately:

- **FirstToUpper**

Since it is a simple implementation, mainly the proposal is to simplify its use as an extension method by extending the current SDK.

### API breakdown

```csharp

public static class StringExtensions
{
// [...] Current methods

public static string FirstToUpper(this string str, thenToLower = true)
{
//Logic
}

```

### Usage example

```csharp

string text = "hello world!";

Console.WriteLine(text.FirstToUpper());

//Hello world!

```

### Breaking change?

No

### Alternatives

-

### Additional context

Any other related methods or considerations? different API definition or naming?

This is one of my proposals of a series of implementations that I made during time in a common project used for the projects of my OpenSource organization, personal projects and projects of the company in which I work.

Currently, I would prefer to include what is practical in a repository with greater scope and practicality, and eliminate what is not necessary or could be improved, leaving the library in a state of maintenance without new developments.

Please refer to [this](https://github.com/ChustaSoft/commonnet) project

### Help us help you

Yes, I'd like to be assigned to work on this item

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.