Private void button2_Click (object sender, EventArgs e)
{// Remove the specified character at the beginning and end of the string
String MyInfo = "-- People's Republic of China --";
// Display "People's Republic of China"
MessageBox. Show (MyInfo. Trim (new char [1] {-}), "message prompt", MessageBoxButtons. OK, MessageBoxIcon. Information );
MyInfo = ",-People's Republic of China -,-";
// Display "People's Republic of China"
MessageBox. Show (MyInfo. Trim (new char [2] {-,}), "message prompt", MessageBoxButtons. OK, MessageBoxIcon. Information );
MyInfo = "-- People's Republic of China --";
// Display "People's Republic of China --"
MessageBox. Show (MyInfo. TrimStart (new char [1] {-}), "message prompt", MessageBoxButtons. OK, MessageBoxIcon. Information );
MyInfo = ",-People's Republic of China -,-";
// Display "People's Republic of China -,-"
MessageBox. Show (MyInfo. TrimStart (new char [2] {-,}), "message prompt", MessageBoxButtons. OK, MessageBoxIcon. Information );
MyInfo = "-- People's Republic of China --";
// Display "-- People's Republic of China"
MessageBox. Show (MyInfo. TrimEnd (new char [1] {-}), "message prompt", MessageBoxButtons. OK, MessageBoxIcon. Information );
MyInfo = ",-People's Republic of China -,-";
// Display ",-People's Republic of China"
MessageBox. Show (MyInfo. TrimEnd (new char [2] {-,}), "message prompt", MessageBoxButtons. OK, MessageBoxIcon. Information );
}