Braintique.com header
Left Navigation Bar

Using String Instance Methods

The String class provides many powerful instance and static methods. These methods are described in this section. Most of these methods are overloaded, so there are multiple ways that each can be used.

The table below describes many of the instance methods of the String class.

Table: Instance Methods of the String Class

Method

What It Does

Clone

Returns a reference to the instance of the string.

CompareTo

Compares this string with another.

CopyTo

Copies the specified number of characters from the string instance to a char array.

EndsWith

Returns true if the specified string matches the end of the instance string.

Equals

Determines whether the instance string and a specified string have the same value.

GetEnumerator

Method required to support the IEnumerator interface (see “Interfaces” later in this chapter).

IndexOf

Reports the index of the first occurrence of a specified character or string within the instance.

Insert

Returns a new string with the specified string inserted at the specified position in the current string.

LastIndexOf

Reports the index of the last occurrence of a specified character or string within the instance.

PadLeft

Returns a new string with the characters in this instance right-aligned by padding on the left with spaces or a specified character for a specified total length.

PadRight

Returns a new string with the characters in this instance left-aligned by padding on the right with spaces or a specified character for a specified total length.

Remove

Returns a new string that deletes a specified number of characters from the current instance beginning at a specified position.

Replace

Returns a new string that replaces all occurrences of a specified character or string in the current instance, with another character or string.

Split

Identifies the substrings in this instance that are delimited by one or more characters specified in an array, then places the substrings into a string array.

StartsWith

Returns true if the specified string matches the beginning of the instance string.

Substring

Returns a substring from the instance.

ToCharArray

Copies the characters in the instance to a character array.

ToLower

Returns a copy of the instance in lowercase.

ToUpper

Returns a copy of the instance in uppercase.

Trim

Returns a copy of the instance with all occurrences of a set of specified characters from the beginning and end removed.

TrimEnd

Returns a copy of the instance with all occurrences of a set of specified characters at the end removed.

TrimStart

Returns a copy of the instance with all occurrences of a set of specified characters from the beginning removed.

Previous Table of Contents Next


Google
 
Web www.braintique.com
www.digitalfieldguide.com www.googleplexblog.com


Home | Barticles | Blogs | Books | Services | FAQ | Contact

© Braintique.com. All rights reserved.

Search Engine Optimization







RSS 2.0 Syndication feed

Syndication Viewer

Our Web host:
IX WebHosting



Food for Your Brain! Get a Barticle! Questions Answered Books for You What We Can Do For You Contact Us Brain Food Questions Answered Books for You What We Can Do For You Frequently Asked Questions About Us Google Research Photoshop Wi-Fi and Wireless Networking The Natural Way to Write