Public Int Length ( String Strlen)
{
Int L, T, C;
Int I;
L = Strlen. length;
T = L;
For (I = 0 ; I < L; I ++ )
{
C = ( Int ) Strlen [I];
If (C < 0 )
{
C = C + 65536 ;
}
If (C > 255 )
{
T = T + 1 ;
}
}
Return T;
}
Public String Substring ( String Strvalue, Int Startindex, Int Length)
{
Int Istarttemp = 0 ;
Int Itemp = 0 ;
String Returnstring = "" ;
If (Length (strvalue) > Startindex)
{
For ( Int I = 0 ; I < Strvalue. length; I ++ )
{
Int C = ( Int ) Strvalue [I];
If (C < 0 )
C + = 65536 ;
If (C > 255 )
Itemp + = 2 ;
Else
Itemp + = 1 ;
If (Itemp > Startindex)
{
Istarttemp = I;
Break ;
}
}
}
Else
Return Returnstring;
Itemp = 0 ;
If (Length (strvalue) > (Startindex + Length ))
{
For ( Int I = Istarttemp; I < Strvalue. length; I ++ )
{
Int C = ( Int ) Strvalue [I];
If (C < 0 )
C + = 65536 ;
If (C > 255 )
Itemp + = 2 ;
Else
Itemp + = 1 ;
If (Itemp > Length)
Break ;
Else
Returnstring + = Strvalue [I]. tostring ();
}
}
Else
{
Returnstring = Strvalue. substring (istarttemp );
}
Return Returnstring;
}