System Namespace
Represents an immutable string of characters.
Visibility |
Constructor |
Parameters |
public |
String |
(
Char
value
)
|
public |
String |
(
Char
value
,
Int32
startIndex
,
Int32
length
)
|
public |
String |
(
SByte
value
)
|
public |
String |
(
SByte
value
,
Int32
startIndex
,
Int32
length
)
|
public |
String |
(
SByte
value
,
Int32
startIndex
,
Int32
length
,
Encoding
enc
)
|
public |
String |
(
Char
value
,
Int32
startIndex
,
Int32
length
)
|
public |
String |
(
Char
value
)
|
public |
String |
(
Char
c
,
Int32
count
)
|
Visibility |
Name |
Parameters |
Return Type |
public |
Clone |
( )
|
Object
|
public static |
Compare |
(
String
strA
,
String
strB
)
|
Int32
|
public static |
Compare |
(
String
strA
,
Int32
indexA
,
String
strB
,
Int32
indexB
,
Int32
length
,
Boolean
ignoreCase
,
CultureInfo
culture
)
|
Int32
|
public static |
Compare |
(
String
strA
,
Int32
indexA
,
String
strB
,
Int32
indexB
,
Int32
length
,
StringComparison
comparisonType
)
|
Int32
|
public static |
Compare |
(
String
strA
,
Int32
indexA
,
String
strB
,
Int32
indexB
,
Int32
length
,
CultureInfo
culture
,
CompareOptions
options
)
|
Int32
|
public static |
Compare |
(
String
strA
,
String
strB
,
Boolean
ignoreCase
)
|
Int32
|
public static |
Compare |
(
String
strA
,
Int32
indexA
,
String
strB
,
Int32
indexB
,
Int32
length
)
|
Int32
|
public static |
Compare |
(
String
strA
,
Int32
indexA
,
String
strB
,
Int32
indexB
,
Int32
length
,
Boolean
ignoreCase
)
|
Int32
|
public static |
Compare |
(
String
strA
,
String
strB
,
Boolean
ignoreCase
,
CultureInfo
culture
)
|
Int32
|
public static |
Compare |
(
String
strA
,
String
strB
,
StringComparison
comparisonType
)
|
Int32
|
public static |
Compare |
(
String
strA
,
String
strB
,
CultureInfo
culture
,
CompareOptions
options
)
|
Int32
|
public static |
CompareOrdinal |
(
String
strA
,
Int32
indexA
,
String
strB
,
Int32
indexB
,
Int32
length
)
|
Int32
|
public static |
CompareOrdinal |
(
String
strA
,
String
strB
)
|
Int32
|
public |
CompareTo |
(
Object
value
)
|
Int32
|
public |
CompareTo |
(
String
strB
)
|
Int32
|
public static |
Concat |
(
String
str0
,
String
str1
)
|
String
|
public static |
Concat |
(
Object
arg0
,
Object
arg1
)
|
String
|
public static |
Concat |
(
String
values
)
|
String
|
public static |
Concat |
(
String
str0
,
String
str1
,
String
str2
,
String
str3
)
|
String
|
public static |
Concat |
(
String
str0
,
String
str1
,
String
str2
)
|
String
|
public static |
Concat |
(
Object
args
)
|
String
|
public static |
Concat |
(
Object
arg0
,
Object
arg1
,
Object
arg2
)
|
String
|
public static |
Concat |
(
Object
arg0
,
Object
arg1
,
Object
arg2
,
Object
arg3
)
|
String
|
public static |
Concat |
(
IEnumerable`1
values
)
|
String
|
public static |
Concat |
(
IEnumerable`1
values
)
|
String
|
public static |
Concat |
(
Object
arg0
)
|
String
|
public |
Contains |
(
String
value
)
|
Boolean
|
public static |
Copy |
(
String
str
)
|
String
|
public |
CopyTo |
(
Int32
sourceIndex
,
Char
destination
,
Int32
destinationIndex
,
Int32
count
)
|
Void
|
public |
EndsWith |
(
String
value
,
Boolean
ignoreCase
,
CultureInfo
culture
)
|
Boolean
|
public |
EndsWith |
(
String
value
)
|
Boolean
|
public |
EndsWith |
(
String
value
,
StringComparison
comparisonType
)
|
Boolean
|
public static |
Equals |
(
String
a
,
String
b
)
|
Boolean
|
public |
Equals |
(
String
value
,
StringComparison
comparisonType
)
|
Boolean
|
public |
Equals |
(
String
value
)
|
Boolean
|
public static |
Equals |
(
String
a
,
String
b
,
StringComparison
comparisonType
)
|
Boolean
|
public |
Equals |
(
Object
obj
)
|
Boolean
|
public static |
Format |
(
String
format
,
Object
arg0
,
Object
arg1
,
Object
arg2
)
|
String
|
public static |
Format |
(
IFormatProvider
provider
,
String
format
,
Object
arg0
,
Object
arg1
)
|
String
|
public static |
Format |
(
IFormatProvider
provider
,
String
format
,
Object
arg0
,
Object
arg1
,
Object
arg2
)
|
String
|
public static |
Format |
(
IFormatProvider
provider
,
String
format
,
Object
args
)
|
String
|
public static |
Format |
(
IFormatProvider
provider
,
String
format
,
Object
arg0
)
|
String
|
public static |
Format |
(
String
format
,
Object
arg0
)
|
String
|
public static |
Format |
(
String
format
,
Object
arg0
,
Object
arg1
)
|
String
|
public static |
Format |
(
String
format
,
Object
args
)
|
String
|
public |
GetEnumerator |
( )
|
CharEnumerator
|
public |
GetHashCode |
( )
|
Int32
|
public |
GetTypeCode |
( )
|
TypeCode
|
public |
IndexOf |
(
String
value
,
Int32
startIndex
,
Int32
count
)
|
Int32
|
public |
IndexOf |
(
String
value
,
Int32
startIndex
)
|
Int32
|
public |
IndexOf |
(
String
value
)
|
Int32
|
public |
IndexOf |
(
String
value
,
Int32
startIndex
,
Int32
count
,
StringComparison
comparisonType
)
|
Int32
|
public |
IndexOf |
(
String
value
,
Int32
startIndex
,
StringComparison
comparisonType
)
|
Int32
|
public |
IndexOf |
(
String
value
,
StringComparison
comparisonType
)
|
Int32
|
public |
IndexOf |
(
Char
value
,
Int32
startIndex
)
|
Int32
|
public |
IndexOf |
(
Char
value
)
|
Int32
|
public |
IndexOf |
(
Char
value
,
Int32
startIndex
,
Int32
count
)
|
Int32
|
public |
IndexOfAny |
(
Char
anyOf
,
Int32
startIndex
,
Int32
count
)
|
Int32
|
public |
IndexOfAny |
(
Char
anyOf
,
Int32
startIndex
)
|
Int32
|
public |
IndexOfAny |
(
Char
anyOf
)
|
Int32
|
public |
Insert |
(
Int32
startIndex
,
String
value
)
|
String
|
public static |
Intern |
(
String
str
)
|
String
|
public static |
IsInterned |
(
String
str
)
|
String
|
public |
IsNormalized |
( )
|
Boolean
|
public |
IsNormalized |
(
NormalizationForm
normalizationForm
)
|
Boolean
|
public static |
IsNullOrEmpty |
(
String
value
)
|
Boolean
|
public static |
IsNullOrWhiteSpace |
(
String
value
)
|
Boolean
|
public static |
Join |
(
String
separator
,
Object
values
)
|
String
|
public static |
Join |
(
String
separator
,
String
value
)
|
String
|
public static |
Join |
(
String
separator
,
IEnumerable`1
values
)
|
String
|
public static |
Join |
(
String
separator
,
String
value
,
Int32
startIndex
,
Int32
count
)
|
String
|
public static |
Join |
(
String
separator
,
IEnumerable`1
values
)
|
String
|
public |
LastIndexOf |
(
String
value
,
Int32
startIndex
,
Int32
count
)
|
Int32
|
public |
LastIndexOf |
(
String
value
,
Int32
startIndex
)
|
Int32
|
public |
LastIndexOf |
(
String
value
,
Int32
startIndex
,
StringComparison
comparisonType
)
|
Int32
|
public |
LastIndexOf |
(
String
value
,
StringComparison
comparisonType
)
|
Int32
|
public |
LastIndexOf |
(
Char
value
,
Int32
startIndex
)
|
Int32
|
public |
LastIndexOf |
(
Char
value
)
|
Int32
|
public |
LastIndexOf |
(
String
value
)
|
Int32
|
public |
LastIndexOf |
(
Char
value
,
Int32
startIndex
,
Int32
count
)
|
Int32
|
public |
LastIndexOf |
(
String
value
,
Int32
startIndex
,
Int32
count
,
StringComparison
comparisonType
)
|
Int32
|
public |
LastIndexOfAny |
(
Char
anyOf
,
Int32
startIndex
,
Int32
count
)
|
Int32
|
public |
LastIndexOfAny |
(
Char
anyOf
,
Int32
startIndex
)
|
Int32
|
public |
LastIndexOfAny |
(
Char
anyOf
)
|
Int32
|
public |
Normalize |
( )
|
String
|
public |
Normalize |
(
NormalizationForm
normalizationForm
)
|
String
|
public |
PadLeft |
(
Int32
totalWidth
,
Char
paddingChar
)
|
String
|
public |
PadLeft |
(
Int32
totalWidth
)
|
String
|
public |
PadRight |
(
Int32
totalWidth
)
|
String
|
public |
PadRight |
(
Int32
totalWidth
,
Char
paddingChar
)
|
String
|
public |
Remove |
(
Int32
startIndex
,
Int32
count
)
|
String
|
public |
Remove |
(
Int32
startIndex
)
|
String
|
public |
Replace |
(
Char
oldChar
,
Char
newChar
)
|
String
|
public |
Replace |
(
String
oldValue
,
String
newValue
)
|
String
|
public |
Split |
(
Char
separator
,
Int32
count
,
StringSplitOptions
options
)
|
String
|
public |
Split |
(
Char
separator
,
StringSplitOptions
options
)
|
String
|
public |
Split |
(
String
separator
,
Int32
count
,
StringSplitOptions
options
)
|
String
|
public |
Split |
(
String
separator
,
StringSplitOptions
options
)
|
String
|
public |
Split |
(
Char
separator
,
Int32
count
)
|
String
|
public |
Split |
(
Char
separator
)
|
String
|
public |
StartsWith |
(
String
value
,
StringComparison
comparisonType
)
|
Boolean
|
public |
StartsWith |
(
String
value
)
|
Boolean
|
public |
StartsWith |
(
String
value
,
Boolean
ignoreCase
,
CultureInfo
culture
)
|
Boolean
|
public |
Substring |
(
Int32
startIndex
,
Int32
length
)
|
String
|
public |
Substring |
(
Int32
startIndex
)
|
String
|
public |
ToCharArray |
( )
|
Char
|
public |
ToCharArray |
(
Int32
startIndex
,
Int32
length
)
|
Char
|
public |
ToLower |
(
CultureInfo
culture
)
|
String
|
public |
ToLower |
( )
|
String
|
public |
ToLowerInvariant |
( )
|
String
|
public |
ToString |
(
IFormatProvider
provider
)
|
String
|
public |
ToString |
( )
|
String
|
public |
ToUpper |
(
CultureInfo
culture
)
|
String
|
public |
ToUpper |
( )
|
String
|
public |
ToUpperInvariant |
( )
|
String
|
public |
Trim |
( )
|
String
|
public |
Trim |
(
Char
trimChars
)
|
String
|
public |
TrimEnd |
(
Char
trimChars
)
|
String
|
public |
TrimStart |
(
Char
trimChars
)
|
String
|
|
An instance of String is said to be "immutable" because its value cannot be modified once it has been created. Methods that appear to modify a String instance actually return a new instance containing the modification. Use the StringBuilder class if it is necessary to actually modify the contents of a string-like object.
An "index" is the position of a character within a string, and is counted starting from the first character in the string, which is index position zero. That is, a string index is said to be "zero-based".
Comparison and search procedures are case-sensitive and use the culture associated with the current thread, unless specified otherwise. For more information about the current culture, see the CurrentCulture topic.
By definition, any String, including the empty string ( "" ), compares greater than a null reference; and two null references compare equal to each other.
Use the Compare and Equals methods to perform combined reference and value comparisons of Object and String instances. The equality and inequality relational operators are implemented with the Equals method and can also be used to make reference and value comparisons.
This class implements the IComparable, ICloneable, IConvertible, and IEnumerable interfaces. Use the Convert class for conversions instead of this type's explicit interface member implementation of IConvertible.
IComparable ICloneable IConvertible IEnumerable StringBuilder CultureInfo Formatting Base Types
|
|