Check whether first character in a string is capital or not

In this tutorial we will learn how to check whether first character in a string is capital or not. It’s pretty simple and don’t required any professional coding. Let’s have a look how to do so.
 
string mystring = "Adeel";

if (mystring[0].ToString() == mystring[0].ToString().ToUpper())
{
    Response.Write("First character is capital");
}
else
{
    Response.Write("First character is not capital");
}

So that’s it, this is the proper and simple way.

Happy Coding!!!

Read more...

Make first character of a string upper case in asp.net

Couple of days ago I got requirement of make first character of a string upper case in asp.net. I found but unable to get any built-in function available in .net so after some sort of coding, I develop my own function.
 
public static string MakeFirstCharUpper(string inputstring)
{
    if (String.IsNullOrEmpty(inputstring))
        throw new ArgumentException("ARGH!");
    return inputstring.First().ToString().ToUpper() + String.Join("",inputstring.ToLower().Trim().Skip(1));
}

So that’s it. Just you have to call this function and you will get desired output.

Happy Coding!!!

Read more...