str: C# .
' ': 3 '': 49 "": 22 "": 33 1 ', '' '': 4
str "C# "
str "."
Contains(). .
public bool Contains(string value)
Contains () true, , value, false. . , , . Contains ().
// Contains().
class ContainsDemo { static void Main() {
string str = "C# .";
if(str.Contains(""))
Console.WriteLine(" \"\".");
if(str.Contains(""))
Console.WriteLine(" \"\".");
if(!str.Contains(""))
Console.WriteLine(" \"\" .");
}
}
.
"".
"".
"" .
, Contains () , . "", "". "", .
, . . 22.3 , String.
22.3. , String
public bool Contains(string value)
public bool EndsWith(string value)
public bool EndsWith(string value, StringComparison comparisonType)
public bool EndsWith(string value, bool ignoreCase, Culturelnfo culture)
true, value. value , false
* true, value. false true, value. false. comparisonType true, value,
|
|
Public int
IndexOf(char value)
false. ignoreCase true, . . , culture
Public int
IndexOf(string value)
value . , -1
Public int
IndexOf(char value, int
value . , -1
startlndex)
value .
Public int
IndexOf(string value,
, startlndex. -1,
int startlndex)
value .
Public int
IndexOf(char value, int
, startlndex. -1,
startlndex,
int count)
value .
Public in.t
IndexOf(string value,
, startlndex, , count. -1,
int startlndex, int count)
value .
Public int
IndexOf(string value,
, startlndex, , count. -1,
StringComparison comparisonType)
value .
. 22.3
comparisonType
. -1,
public int IndexOf(string value,
int startlndex, StringComparison
value .
comparison Type)
, startlndex. comparisonType . -1,
|
|
public int IndexOf(string value,
int startlndex, int count,
value .
StringComparison comparisonType)
, startlndex, , count. comparisonType . -1,
public int LastlndexOf(char value)
value . , -1
public int IndexOfAny(char[] anyOf)
anyOf, . -1, anyOf.
public int IndexOfAny(char[] anyOf,
int startlndex)
anyOf, . , startlndex -1, anyOf.
public int IndexOfAny(char [] anyOf,
int startlndex, int count)
anyOf, . , ^ startlndex,
, count. -1, anyOf.
public int LastlndexOf(string value)
value . , -1
public int LastlndexOf(char value,
int startlndex)
value . , , startlndex, . -1,
public int LastlndexOf(string value,
int startlndex)
value . , , startlndex, . -1,
public int LastlndexOf(char value,
int startlndex, int count)
value . , , startlndex, , count. -1,
public int LastlndexOf(string value,
int startlndex, int count)
value . , , startlndex, , count. -1,
public int LastlndexOf(string value,
StringComparison comparisonType)
|
|
value . comparisonType . -1,
_ . 22.3
public int LastlndexOf(string value,
int startlndex, StringComparison
value
comparisonType)
. , , startlndex, . comparisonType . -1,
public int LastlndexOf(string value,
int startlndex, int count,
value
StringComparison comparisonType)
. , , startlndex, , count. comparisonType . -1,
public int LastlndexOfAny(char[]
anyOf)
anyOf, . -1, anyOf.
public int LastlndexOfAny(char[]
anyOf, int startlndex)
anyOf, . , startlndex, . -1, anyOf.
public int LastlndexOfAny(char[]
anyOf, int startlndex, int count)
anyOf, . , , startlndex, , count, , count. -1,
public bool StartsWith(string value)
public bool StartsWith(string value, StringComparison comparisonType)
public bool StartsWith(string value, bool ignoreCase, Culturelnfo culture)
anyOf. true, value. false true, value. false. comparisonType true, value. false. ignoreCase true, . . , culture
|
|
. , . String Split (), Join ().
Split (). , , C# 1.0.
public string[ ] Split(params char[ ] separator)
public string[ ] Split(params char[ ] separator, int count)