Using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. Web;
Using System. Web. UI;
Using System. Web. UI. WebControls;
Public partial class _ Default: System. Web. UI. Page
{
Protected void Page_Load (object sender, EventArgs e)
{
Test ();
}
Public void Test ()
{
String str = "Now is the time for all good men to come to the aid of their party .";
Int start;
Int;
Console. WriteLine ();
Console. WriteLine ("All occurrences of 't' from position 0 to {0}.", str. Length-1 );
// Console. WriteLine ("{1} {0} {2} {0} {3} {0}", Environment. NewLine, br1, br2, str );
Console. Write ("The letter 't'occurs at position (s ):");
At = 0;
Start = 0;
// Obtain the location of each t
While (start <str. Length) & (at>-1 ))
{
At = str. IndexOf ('T', start );
If (at =-1) break;
Console. Write ("{0}", );
Start = at + 1;
}
String a = "a bcde ";
Int index = a. IndexOf ('E ');
Int index1 = a. IndexOf ('E', 0 );
// Obtain the ip address with an asterisk
String ip = "127.0.0.123 ";
String ip2 = "123456 ";
String index2 = ip2.Substring (0, 3 );
String changeip = ip. Substring (0, ip. LastIndexOf (".") + 1) + "*";
}
}