All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ioc.commons.impl.gwt.client.ui.JsUtil Maven / Gradle / Ivy

There is a newer version: 1.2.1
Show newest version
package org.ioc.commons.impl.gwt.client.ui;

public class JsUtil {
	private JsUtil() {
		// Sólo métodos estáticos
	}

	public static native double extractNumberValue(String s) /*-{
		if (s == "auto" || s == "inherit" || s == "") {
			return 0;
		} else {
			// numberRegex is similar to java.lang.Number.floatRegex, but divides
			// the string into a leading numeric portion followed by an arbitrary
			// portion.
			var numberRegex = @com.google.gwt.user.client.ui.UIObject::numberRegex;
			if (!numberRegex) {
				numberRegex = @com.google.gwt.user.client.ui.UIObject::numberRegex = /^(\s*[+-]?((\d+\.?\d*)|(\.\d+))([eE][+-]?\d+)?)(.*)$/;
			}

			// Extract the leading numeric portion of s
			s = s.replace(numberRegex, "$1");
			return parseFloat(s);
		}
	}-*/;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy