String processing: Private Void Anscode ( String URL)
{
String Date = "" ;
String Open = "" ;
String High = "" ;
String Low = "" ;
String Close = "" ;
String Transa = "" ;
String Transb = "" ;
String Str = URL;
String S1 = "" , S2 = "" , S3 = "" , S4 = "" ;
Int Pos1 = 0 , Pos2 = 0 , Pos3 = 0 , Pos4 = 0 ;
Int Flag = 0 ;
While (Pos1 = Str. indexof ( " <TD align = middle> " )) ! =- 1 )
{
Pos1 + = 17 ;
Str = Str. Remove ( 0 , Pos1 );
Pos2 = Str. indexof ( " </TD> " );
S1 = Str. substring ( 0 , Pos2 );
If (Flag = 0 )
{< br> date = S1;
// MessageBox. show (date);
flag ++ ;
}
Else If (Flag = 4 )
{
Close = S1;
Flag ++ ;
Pos3 = Str. indexof ( " <TD align = right> " );
Pos3 + = 16 ;
Str = Str. Remove ( 0 , Pos3 );
Pos4 = Str. indexof ( " </TD> " );
S1 = Str. substring ( 0 , Pos4 );
Transa = S1;
Flag ++ ;
Pos3 = Str. indexof ( " <TD align = right> " );
Pos3 + = 16 ;
Str = Str. Remove ( 0 , Pos3 );
Pos4 = Str. indexof ( " </TD> " );
S1 = Str. substring ( 0 , Pos4 );
Transb = S1;
Flag ++ ;
}
Else If (Flag = 1 )
{
Open=S1;
Flag++;
}
Else If (Flag = 2 )
{
High=S1;
Flag++;
}
Else If (Flag = 3 )
{
Low=S1;
Flag++;
}
If (Flag = 7 )
{
// Process the close string
Int T1 = Close. indexof ( " <B> " );
T1 + = 3 ;
Close = Close. Remove ( 0 , T1 );
Int T2 = Close. indexof ( " </B> " );
Close = Close. Remove (t2, 4 );
Flag = 0 ;
// Data is displayed in the list
Listviewitem LV = New Listviewitem ();
// MessageBox. Show (date );
LV. subitems. Clear ();
LV. subitems [ 0 ]. Text = Date;
LV. subitems. Add (open );
LV. subitems. Add (high );
LV. subitems. Add (low );
LV. subitems. Add (close );
LV. subitems. Add (transa );
LV. subitems. Add (transb );
Listview1.items. Add (LV );
}
}
MessageBox. Show ( " Collection Completed " );
}
the URL is the source code of the webpage.