need some java guru help...

holmBrew

Official Volunteer
how would i check this string:

Mozilla/4.0 (compatible; MSIE 5.12; Mac_PowerPC)

with java for the existence of the String "MSIE"

i want to do something like...

if (request.getHeader("User-Agent").contains("MSIE"))
{
..do something..
} else {
..do something else..
}

btw - this is in a JSP....

thanks,
jason
 
String data = "sna cousnto emknor.gbi FOOBAR santoeu snmt";
String desiredData = "FOOBAR";

if (data.indexOf(desiredData) >= 0)
{
; // yay
}

// indexOf searches the string and returns the location of the first character location of the string you want, or -1 if not found.

You might want to downcase the data before searching

if (data.toLowerCase().indexOf(desiredData) >= 0)

After coding, it freaks me out when OmniWeb fails to highlight matching parentheses for me. ;-)
 
Back
Top