Friday, January 11, 2013

The System.String Data Type in C#.NET

The C# string keyword is a shorthand notation of the System.String type, which provides a number of members you would expect from such a utility class. Below lists are some (but not all) of the interesting members.

Length  - This property returns the length of the current string.

Contains()  - This method is used to determine if the current string object contains a specified string.

Format()  - This static method is used to format a string literal using other primitives

Insert()  - This method is used to receive a copy of the current string that contains newly inserted string data.

PadLeft(), PadRight()

 - These methods return copies of the current string that has been padded with specific data.

Remove(), Replace() 
Use these methods to receive a copy of a string, with modifications
(characters removed or replaced.)

Substring() - This method returns a string that represents a substring of the current string.

ToCharArray()  - This method returns a character array representing the current string.

ToUpper() , ToLower()
- These methods create a copy of a given string in uppercase or lowercase.

No comments:
Write comments
Recommended Posts × +