typeOf static method
Implementation
static UCodeValueType typeOf(String text, UCodeFormat format) {
if (format == UCodeFormat.ean13 || format == UCodeFormat.ean8 || format == UCodeFormat.upcA || format == UCodeFormat.upcE) {
if (text.startsWith("978") || text.startsWith("979")) return UCodeValueType.isbn;
return UCodeValueType.product;
}
final String upper = text.toUpperCase();
if (upper.startsWith("HTTP://") || upper.startsWith("HTTPS://") || upper.startsWith("WWW.")) return UCodeValueType.url;
if (upper.startsWith("MAILTO:") || upper.startsWith("MATMSG:")) return UCodeValueType.email;
if (upper.startsWith("TEL:")) return UCodeValueType.phone;
if (upper.startsWith("SMSTO:") || upper.startsWith("SMS:")) return UCodeValueType.sms;
if (upper.startsWith("WIFI:")) return UCodeValueType.wifi;
if (upper.startsWith("GEO:")) return UCodeValueType.geo;
if (upper.startsWith("BEGIN:VEVENT")) return UCodeValueType.calendar;
if (upper.startsWith("BEGIN:VCARD") || upper.startsWith("MECARD:")) return UCodeValueType.contact;
if (upper.startsWith("UPI://")) return UCodeValueType.upiPayment;
return UCodeValueType.text;
}