import java.util.Map;
import java.util.Map.Entry;
-import javajs.J2SIgnoreImport;
import javajs.api.JSONEncodable;
/**
*
*/
-@J2SIgnoreImport(value = { java.lang.reflect.Array.class })
public class PT {
public static int parseInt(String str) {
return (ichLast < ich ? "" : str.substring(ich, ichLast + 1));
}
- public static double dVal(String s) throws NumberFormatException {
- /**
- * @j2sNative
- *
- * if(s==null)
- * throw new NumberFormatException("null");
- * var d=parseFloat(s);
- * if(isNaN(d))
- * throw new NumberFormatException("Not a Number : "+s);
- * return d
- *
- */
- {
- return Double.valueOf(s).doubleValue();
- }
- }
-
- public static float fVal(String s) throws NumberFormatException {
- /**
- * @j2sNative
- *
- * return this.dVal(s);
- */
- {
- return Float.parseFloat(s);
- }
- }
+// public static double dVal(String s) throws NumberFormatException {
+// /**
+// * @j2sNative
+// *
+// * if(s==null)
+// * throw new NumberFormatException("null");
+// * var d=parseFloat(s);
+// * if(isNaN(d))
+// * throw new NumberFormatException("Not a Number : "+s);
+// * return d
+// *
+// */
+// {
+// return Double.valueOf(s).doubleValue();
+// }
+// }
+//
+// public static float fVal(String s) throws NumberFormatException {
+// /**
+// * @j2sNative
+// *
+// * return this.dVal(s);
+// */
+// {
+//
+// return Float.parseFloat(s);
+// }
+// }
public static int parseIntRange(String str, int ichMax, int[] next) {
int cch = str.length();
}
/**
+ * single- or double-quoted string or up to the first space -- like HTML5
+ * not case-sensitive
+ *
+ * @param line
+ * @param key
+ * @return attribute
+ */
+ public static String getQuotedOrUnquotedAttribute(String line, String key) {
+ if (line == null || key == null)
+ return null;
+ int pt = line.toLowerCase().indexOf(key.toLowerCase() + "=");
+ if (pt < 0 || (pt = pt + key.length() + 1) >= line.length())
+ return "";
+ char c = line.charAt(pt);
+ switch (c) {
+ case '\'':
+ case '"':
+ pt++;
+ break;
+ default:
+ c = ' ';
+ line += " ";
+ }
+ int pt1 = line.indexOf(c, pt);
+ return (pt1 < 0 ? null : line.substring(pt, pt1));
+ }
+
+ /**
* CSV format -- escaped quote is "" WITHIN "..."
*
*
return info instanceof Number || info instanceof Boolean;
}
- private static Object arrayGet(Object info, int i) {
- /**
- *
- * Note that info will be a primitive in JavaScript
- * but a wrapped primitive in Java.
- *
- * @j2sNative
- *
- * return info[i];
- */
- {
- return Array.get(info, i);
- }
- }
-
+// private static Object arrayGet(Object info, int i) {
+// /**
+// *
+// * Note that info will be a primitive in JavaScript
+// * but a wrapped primitive in Java.
+// *
+// * @j2sNative
+// *
+// * return info[i];
+// */
+// {
+// return Array.get(info, i);
+// }
+// }
+//
@SuppressWarnings("unchecked")
public static String toJSON(String infoType, Object info) {
if (info == null)
for (int i = 0; i < n; i++) {
if (i > 0)
sb.appendC(',');
- sb.append(toJSON(null, arrayGet(info, i)));
+ sb.append(toJSON(null, Array.get(info, i)));
}
sb.append("]");
break;
/**
* @j2sNative
*
- * return (x.constructor == Array || x.__BYTESIZE ? null : x.toString());
+ * return (x.constructor == Array || x.BYTES_PER_ELEMENT ? null : x.toString());
*
*/
{