@Test public void testGetInt() throws Exception { int test_int = WXUtils.getInt("23px"); assertEquals(23, test_int); }
public static int getInt(Object value) { if (value == null) { return 0; } String temp = value.toString().trim(); if (temp.endsWith("px")) { temp = temp.substring(0, temp.indexOf("px")); } int result = 0; try { result = Integer.parseInt(temp); } catch (NumberFormatException e) { } return result; }
WXUtils { public static int getInt(Object value) { if (value == null) { return 0; } String temp = value.toString().trim(); if (temp.endsWith("px")) { temp = temp.substring(0, temp.indexOf("px")); } int result = 0; try { result = Integer.parseInt(temp); } catch (NumberFormatException e) { } return result; } }
WXUtils { public static int getInt(Object value) { if (value == null) { return 0; } String temp = value.toString().trim(); if (temp.endsWith("px")) { temp = temp.substring(0, temp.indexOf("px")); } int result = 0; try { result = Integer.parseInt(temp); } catch (NumberFormatException e) { } return result; }  }
WXUtils { public static int getInt(Object value) { if (value == null) { return 0; } String temp = value.toString().trim(); if (temp.endsWith("px")) { temp = temp.substring(0, temp.indexOf("px")); } int result = 0; try { result = Integer.parseInt(temp); } catch (NumberFormatException e) { } return result; }  static boolean isUiThread(); static boolean isUndefined(float value); static float getFloat(Object value); static Float getFloat(Object value, @Nullable Float df); static float fastGetFloat(String raw, int precision); static float fastGetFloat(String raw); static int getInt(Object value); static Integer getInteger(@Nullable Object value, @Nullable Integer df); static long getLong(Object value); static double getDouble(Object value); static boolean isTabletDevice(); static Boolean getBoolean(@Nullable Object value, @Nullable Boolean df); static long getAvailMemory(Context context); static String getString(@Nullable Object value,@Nullable String df); static int parseUnitOrPercent(String raw, int unit); }
WXUtils { public static int getInt(Object value) { if (value == null) { return 0; } String temp = value.toString().trim(); if (temp.endsWith("px")) { temp = temp.substring(0, temp.indexOf("px")); } int result = 0; try { result = Integer.parseInt(temp); } catch (NumberFormatException e) { } return result; }  static boolean isUiThread(); static boolean isUndefined(float value); static float getFloat(Object value); static Float getFloat(Object value, @Nullable Float df); static float fastGetFloat(String raw, int precision); static float fastGetFloat(String raw); static int getInt(Object value); static Integer getInteger(@Nullable Object value, @Nullable Integer df); static long getLong(Object value); static double getDouble(Object value); static boolean isTabletDevice(); static Boolean getBoolean(@Nullable Object value, @Nullable Boolean df); static long getAvailMemory(Context context); static String getString(@Nullable Object value,@Nullable String df); static int parseUnitOrPercent(String raw, int unit); static final char PERCENT; }