C # also learned for a long time, although still ignorant, but still have a harvest, and then summed up
ToCharArray string array
String text= "haha, Xiao Yang teacher is young again"
char[] chs=text. ToCharArray ();
Chs[5]= "very";//modifier
string str =new string (CHS);
Console.WriteLine (str);
Converts a string to lowercase
Str2=str2. ToLower ();
Converts a string to uppercase
Str1=str1. Upper ();
Ignore case comparison
Str1.equals (str2,string comparison.ordinalignorecase);
Some characters or strings in a string are replaced
Name=name. Repalce (' very ', ' no ') '
Find a string index and intercept
Str=str. Substring (3,6);//Intercept string
To determine whether a substring is contained in a string
(If "evil" is included in the string, replace evil with purity.)
BOOL Result=name.contains ("evil");
if (result)
{
name=name. Replace ("Evil", "* *");
Console.WriteLine (name);
else
{
Console.WriteLine (name);
}
Determines whether a string starts with a string
StartsWith
String str= "Xiao Yang is very pure";
BOOL Result=str. Startwith ("Xiao Yang");
if (result)
{
Console.WriteLine ("Has this string")
}
else
{
Console.WriteLine ("No This string")
}
Determines whether a string ends with a string
EndsWith
String str= "Xiao Yang is very pure";
BOOL Result=str. EndsWith ("purity");
if (result)
{
Console.WriteLine ("Has this string")
}
else
{
Console.WriteLine ("No This string")
}
The general feeling to sum up a lot, but still a little bit, become the basic knowledge of the repeated.