Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# string capital first letter extension method

public static class StringExtensions
{
    public static string FirstCharToUpper(this string input) =>
        input switch
        {
            null => throw new ArgumentNullException(nameof(input)),
            "" => throw new ArgumentException($"{nameof(input)} cannot be empty", nameof(input)),
            _ => input.First().ToString().ToUpper() + input.Substring(1)
        };
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: unity disable parent gameobject 
Csharp :: c# get first 5 characters of string 
Csharp :: How to read StreamReader text line by line 
Csharp :: raycast unity 
Csharp :: unity smooth camera 2d 
Csharp :: mailkit send attachment 
Csharp :: c# create array of number from number 
Csharp :: get values from range entity framework 
Csharp :: move to another scene unity 
Csharp :: phone number regex in c# 
Csharp :: even number checker in c# 
Csharp :: executable path with app name c# 
Csharp :: random.range unity 
Csharp :: check if ienumerable is empty c# 
Csharp :: unity change tag of go 
Csharp :: C# socket bind to dns name 
Csharp :: c# list shuffle 
Csharp :: text not centered winforms button 
Csharp :: after each vue router 
Csharp :: unity cinemachine lock camera axis 
Csharp :: how to get element dictionary key in c# by index 
Csharp :: stop sound in unity 
Csharp :: iterate through xpdictionary devexpress 
Csharp :: use only one class from a namespace in c# 
Csharp :: pass datatable to stored procedure c# dapper 
Csharp :: c# separate string by comma 
Csharp :: wpf update listview itemssource 
Csharp :: how to have is trigger on but also have collisions 
Csharp :: C# datetime.now to string only numbers 
Csharp :: Xamarin.Forms - How to navigate to a tabbed page child page 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =