i take no credit for this got from a google search(couldnt remeber indexOf("), even though its not remotely difficult.
for those who arent sure its just a set of boolean's for checking the operating system, i hadnt seen it released so thought it may be handy for those wanting to make their clients more widely compatible
Code:
public class OSValidator {
private static String OS = System.getProperty("os.name").toLowerCase();
public static boolean isWindows() {
return (OS.indexOf("win") >= 0);
}
public static boolean isMac() {
return (OS.indexOf("mac") >= 0);
}
public static boolean isUnix() {
return (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0 );
}
public static boolean isSolaris() {
return (OS.indexOf("sunos") >= 0);
}
}