Posts

Showing posts from June, 2015

STRINGS CHECK (EMPTYORNULL) IN C#

Image
Today in Engineer's World, we are discussinga very important topic of C# -String in very easy way. Posted By- +Manish Kumar Gautam+LIV WIRE+ASP.NET SOLUTIONS

Click imaginationhunt.blogspot to see latest BlogsTo read STRINGS (NULLOREMPTY) IN C# - Click here.


CHECK BLANK STRING

A blank string is a type of string which contains nothing. Nothing means not even a single character and whose length is zero.



Let's just understand this by an example.

Example- There is a simple user input program. In which the system ask user to input his name. And then it prints the name to the output screen.

Practical Implementation:

using System;

namespaceAspnetSolutions
{
    class StringCheckNullEmpty
    {
        public static void Main()
        {
            Console.WriteLine("Enter You name");
            string name = Console.ReadLine();

            Console.WriteLine("Your name is = {0}.", name);
         }
    }
}

Output




Click imaginationhunt.blogspot to see latest Blogs

Hence, we get the ou…

STRINGS (NULLOREMPTY) IN C#

Image
Today in Engineer's World, we are discussinga very important topic of C# -String in very easy way. Posted By- +Manish Kumar Gautam+LIV WIRE+ASP.NET SOLUTIONS

Click imaginationhunt.blogspot to see latest BlogsTo read IS STRING MUTABLE OR IMMUTABLE IN .NET? - Click here.

How many ways are there in which we can make our string null or empty?



4 Ways:- Making string Null and Empty
1. Using ""(Double Quotes)Double Quotes are the way in which we make our string holding zero characters. Its length is zero. For ex- string str = "";
2. Using "   "(White Spaces)White spaces are the way in which we make our string storing some data but actually they are blank spaces. They possess some length but in real they contain only blank spaces.
3. Using String.EmptyAn empty string means a string that contains zero characters, whose length is zero. It is an instance of System.String object.
Click imaginationhunt.blogspot to see latest Blogs
4. Using NULL"null" is also u…

IS STRING MUTABLE OR IMMUTABLE IN .NET?

Image
Today in Engineer's World, we are discussinga very important topic of C# -String in very easy way. Posted By- +Manish Kumar Gautam+LIV WIRE+ASP.NET SOLUTIONS
Click imaginationhunt.blogspot to see latest BlogsTo read STRING.LENGTH PROPERTY IN C# - Click here.
What does Mutable means?
Mutable: Mutable means whose state can be changed after it is created. In simple terms to remind and understand the term you can relate it by word "Mutants". For ex- In X-Men, Jennifer Lawrence has the power to change itself from Mutant to Human being and back to mutant.



What does Immutable means?
Immutable: Immutable means whose state cannot be changed once it is created. For ex- A human being cannot change its state. He can wear a different type costume to look different but that doesn't mean his state has been changed.
Well, we are very much clear about the differences between these two terms.   Now, put our focus on iterating whether strings are mutable or immutable?Let's check it out.…

STRING.LENGTH PROPERTY IN C#

Image
Today in Engineer's World, we are discussinga very important topic of C# -String in very easy way. Posted By- +Manish Kumar Gautam+LIV WIRE+ASP.NET SOLUTIONS
Click imaginationhunt.blogspot to see latest BlogsTo read STRINGS (SUBSTRING) IN C# Part 4 - Click here.

String.Length

Length is used to get the number of character used in the specified string from the given string. Its return type is Integer. Length property always implemented as String.Length.
Practical Implementation:
using System;

namespaceAspnetSolutions
{
    class StringLength
    {
        public static void Main()
        {
            string str = "Name=Tapan,Education=BCA,Mb=xxxxxxx,Email=Tap@tap.com";            Console.WriteLine("Length");
            //Using Length
            Console.WriteLine("Using String: " + str.Length);
            Console.WriteLine("Using Substring: " + str.Substring(str.LastIndexOf("T")).Length);         }
    }
}

Output


Click imaginationhunt.blogspot to…