1. Basic characteristics of strings
The length of the string is not to become;
2. Methods of strings
There are many ways to string strings such as: compare (), Trim (), IsNullOrEmpty (), ToUpper (), and so on.
(1). IsNullOrEmpty ();(It is used to determine whether a string is empty. Returns true if NULL is NOT NULL returns FALSE)
string s = "';
if (string. IsNullOrEmpty (s))
{
}
(2). Format ();(It is used for formatting strings);
Grammar:
String Name= "Zhang San";
String age = "12";
string s = String. Format ("I call {0} this year {1} years old.", Name,age);
(3). Contains ();(It is used to determine whether a string contains another string, if it contains returns True, does not include the return false);
string S1 = "Zhang San pay electricity";
String s2 = "Electricity Bill";
if (S1. Contains (S2))
{
}
Else
{
}
(4). ToUpper ();(The English letter of the specified string into uppercase);
Grammar:
string s = "abc"
s =s.toupper ();
(5). ToLower ();(The English letter of the specified string into lowercase);
Grammar:
string s = "ABC"
s =s.tolower ();
Common methods for C # strings (string)