Public static hashtable parsequerystring (string S)
{
Object OBJ = NULL;
If (S = NULL)
Throw new illegalargumentexception ();
Hashtable = new hashtable ();
Stringbuffer = new stringbuffer ();
String as [];
String S2;
For (stringtokenizer = new stringtokenizer (S, "&"); stringtokenizer. hasmoretokens (); hashtable. Put (S2, ))
{
String S1 = stringtokenizer. nexttoken ();
Int I = s1.indexof (61 );
If (I =-1)
Throw new illegalargumentexception ();
S2 = parsename (s1.substring (0, I), stringbuffer );
String S3 = parsename (s1.substring (I + 1, s1.length (), stringbuffer );
If (hashtable. containskey (S2 ))
{
String AS1 [] = (string []) hashtable. Get (S2 );
As = new string [as1.length + 1];
For (Int J = 0; j <as1.length; j ++)
As [J] = AS1 [J];
As [as1.length] = S3;
} Else
{
As = new string [1];
As [0] = S3;
}
}
Return hashtable;
}
This is a method of httputil In the servlet package, where
String S = "ABCDE & fgh61 = klklkl ";
System. Out. println ("S. indexof (61):" + S. indexof (61 ));
Indexof returns the equal sign position in the string.
2.
File file;
File = file. createtempfile ("policy", "pdf ");
System. Out. println (file. getname ());
This statement returns a temporary file similar to policy % PDF. The first parameter is the prefix of the file name, the second parameter is the suffix of the file name, and the third parameter can not be specified (mark the path of the temporary file directory)
System. Out. println (file. getabsolutefile (); or
System. Out. println (file. getabsolutepath (); returns the absolute path of the temporary file:
C: \ release E ~ 1 \ admini ~ 1 \ locals ~ 1 \ temp \ policy26872pdf
System. Out. println (file. GetCanonicalPath (); a comparison rule string is returned:
C: \ Documents and Settings \ Administrator \ Local Settings \ temp \ policy58766pdf
System. Out. println (file. getparent (); ===" c: \ police ~ 1 \ admini ~ 1 \ locals ~ 1 \ Temp
System. Out. println (file. touri (); ===" file:/C:/example E ~ 1/admini ~ 1/locals ~ 1/temp/policy45597pdf
System. Out. println (file. tourl (); ===" file:/C:/docume ~ 1/admini ~ 1/locals ~ 1/temp/policy45597pdf