public static boolean isMobileDevice(String requestHeader) { /** * android : 所有android设备 mac os : iphone ipad windows phone:Nokia等windows系统的手机 */ // String[] deviceArray = new // String[]{"android","mac os","windows phone"}; String[] deviceArray = new String[] { "android", "iphone", "ipod", "ipad", "windows phone", "mqqbrowser" }; if (requestHeader == null) return false; requestHeader = requestHeader.toLowerCase(); for (int i = 0; i < deviceArray.length; i++) { if (requestHeader.indexOf(deviceArray[i]) > 0) { return true; } } return false; }
不太明白indexOf什么时候大于0
Caballarii
相关分类