Brerk completely breaks the loop and jumps out of the for statement.
Continue interrupts the current loop and performs the next loop
Length of S. length S
S. Trim () Remove spaces on both sides
S. trimstart () removes the leading space
S. trimend () removes Spaces
S. toupper () uppercase letters
S. tolower () letters smaller to write
S. substring () 1. Trash position to the last 2. (trash position, length)
S. startswith () determines whether the start of the string matches
S. endswith () determines whether the end of the string matches
S. Contains () Middle
S. indexof () position where the first appearance of the number of front faces
S. lastindexof () from the position where the next number appears for the first time
S. Replace () replace
Example:
// Determine whether the date is correct
Console. Write ("input year ");
Int I = convert. toint32 (console. Readline ());
Console. Write ("input month ");
Int M = convert. toint32 (console. Readline ());
Console. Write ("input date ");
Int n = convert. toint32 (console. Readline ());
If (I> = 1 & I <= 9999)
{
If (I % 400 = 0 | I % 4 = 0 & I % 100! = 0)
{
If (M> = 1 & M <= 12)
{
If (n> = 1 & n <= 31 & (M = 1 | M = 3 | M = 5 | M = 7 | M = 8 | M = 10 | M = 12 ))
{
Console. writeline ("the date you entered is correct ");
}
Else if (n> = 1 & n <= 30 & (M = 4 | M = 6 | M = 9 | M = 11 ))
{
Console. writeline ("the date you entered is correct ");
}
Else if (n> = 1 & n <= 29)
{
Console. writeline ("the date you entered is correct ");
}
Else
{
Console. writeline ("the value you entered is meaningless ");
}
}
Else
{
Console. writeline ("the value you entered is meaningless ");
}
}
Else
{
If (M> = 1 & M <= 12)
{
If (n> = 1 & n <= 31 & (M = 1 | M = 3 | M = 5 | M = 7 | M = 8 | M = 10 | M = 12 ))
{
Console. writeline ("the date you entered is correct ");
}
Else if (n> = 1 & n <= 30 & (M = 4 | M = 6 | M = 9 | M = 11 ))
{
Console. writeline ("the date you entered is correct ");
}
Else if (n> = 1 & n <= 28)
{
Console. writeline ("the date you entered is correct ");
}
Else
{
Console. writeline ("input error ");
}
}
Else
{
Console. writeline ("input error ");
}
}
}
Else
{
Console. writeline ("input error ");
}
// Specifies the date when the ID card is intercepted.
Console. writeline ("Enter your ID card number :");
String I = convert. tostring (console. Readline ());
If (I. Length = 18)
{
Console. writeline (I. substring (6, 8 ));
}
Else
{
Console. writeline ("input error ");
}
// Determine the email address
Console. Write ("input Email :");
String S = console. Readline ();
Bool M = S. startswith ("");
Bool n = S. startswith (".");
Int A = S. indexof ("@");
Int c = S. lastindexof ("@");
Bool B = S. Contains (".");
Bool d = S. Contains ("..");
If (M = n = d = false &! = 0 &! = C & B = true)
{
Console. writeline ("yes ");
}
Else
Console. writeline ("not ");
140821 string, number, date and Application Example