What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 500 |  Welcome, Guest!   Register  Login
 Home > Interview Questions > .NET Framework Interview Questions > What is meant by TRIM() ? ... ...

What is meant by TRIM() ?

Interview question and answer by: Bharathi Cherukuri | Posted on: 4/26/2012 | Category: .NET Framework Interview questions | Views: 538 | | Points: 40


Answer:

TRIM() helps us to remove the off spaces characters from the beginning and from the end of the instance.

Example:

using System;


public class Example
{
public static void Main()
{
Console.Write("Enter your first name: ");
string firstName = Console.ReadLine();

Console.Write("Enter your middle name or initial: ");
string middleName = Console.ReadLine();

Console.Write("Enter your last name: ");
string lastName = Console.ReadLine();

Console.WriteLine();
Console.WriteLine("You entered '{0}', '{1}', and '{2}'.",
firstName, middleName, lastName);

string name = ((firstName.Trim() + " " + middleName.Trim()).Trim() + " " +
lastName.Trim()).Trim();
Console.WriteLine("The result is " + name + ".");
}
}


// The following is possible output from this example:
// Enter your first name: John
// Enter your middle name or initial:
// Enter your last name: Doe
//
// You entered ' John ', '', and ' Doe'.
// The result is John Doe

Asked In: Many Interviews | Alert Moderator 
Found interesting? Add this to:


>> Write Response - Respond to this post and get points

Even more ... | Submit Interview Questions and win prizes!

More Interview Questions from Bharathi Cherukuri

Even more ... | Submit Interview Questions and win prizes!


About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/23/2013 8:48:49 PM