String. Empty! = Null;
If a TextBox has no value, if (TextBox. Text = String. Empty) ==> the result is:
FALSE
If (TextBox. Text = String. Empty) => the result is:
TRUE;
If the String is null in 2.0, String. IsNullOrEmpty (str) = True indicates that the String is null (null and "");
Note: "=" can only determine whether the "references" of two strings are the same;
To confirm whether the two strings are the same, use Equals.
Example:
String STR = "Sss"; // STR cannot be null. It can be "";
String STRs = NULL;
Str. Equals (STRs) = false;
If STR = "";
Str. Equals (STRs) = false;
// Obtain the location code of Chinese Characters
Byte [] array = new byte [2];
Array = System. Text. Encoding. Default. GetBytes ("ah ");
Int i1 = (short) (array [0]-'\ 0 ');
Int i2 = (short) (array [1]-'\ 0 ');
// Chinese character codes in unicode decoding mode
Array = System. Text. Encoding. Unicode. GetBytes ("ah ");
I1 = (short) (array [0]-'\ 0 ');
I2 = (short) (array [1]-'\ 0 ');
// Unicode deserialization for Chinese Characters
String str = "4a55 ";
String s1 = str. Substring (0, 2 );
String s2 = str. Substring (2, 2 );
Int t1 = Convert. ToInt32 (s1, 16 );
Int t2 = Convert. ToInt32 (s2, 16 );
Array [0] = (byte) t1;
Array [1] = (byte) t2;
String s = System. Text. Encoding. Unicode. GetString (array );
// Decodes Chinese characters in the default mode
Array [0] = (byte) 196;
Array [1] = (byte) 207;
S = System. Text. Encoding. Default. GetString (array );
// Obtain the string length
S = "iam square gun ";
Int len = s. Length; // will output as 6
Byte [] sarr = System. Text. Encoding. Default. GetBytes (s );
Len = sarr. Length; // will output as 3 + 3*2 = 9
// String Addition
System. Text. StringBuilder sb = new System. Text. StringBuilder ("");
Sb. Append ("I ");
Sb. Append ("am ");
Sb. Append ("square gun ");
0 0
0
(Please comment on the article)