public String To_str(Object o) { if (o == null) return "<<NULL>>"; Class<?> type = Type_adp_.ClassOf_obj(o); String rv = null; if (type == String.class) rv = String_.cast(o); else if (Int_.TypeMatch(type)) return Int_.To_str(Int_.cast(o)); else if (Type_adp_.Eq(type, Bool_.Cls_ref_type)) return Yn.To_str(Bool_.cast(o)); else if (type == DateAdp.class) return DateAdp_.cast(o).XtoStr_gplx(); else rv = Object_.Xto_str_strict_or_empty(o); return String_.Replace(rv, "'", "''"); }
public boolean ReadYn_toggle(String k, boolean cur) { Object rv = ReadOr(k, "!"); if (rv == Nil) ThrowNotFound(k); if (!parse) throw Err_.new_wo_type("only parse supported"); String rv_str = (String) rv; return (String_.Eq(rv_str, "!")) ? !cur : Yn.parse(rv_str); }
@gplx.Virtual protected Object ReadOr(String k, Object defaultOr) { if (args == null) return Nil; // WORKAROUND.gfui: args null for DataBndr_whenEvt_execCmd if (!String_.Eq(k, "")) { for (int i = 0; i < args.Count(); i++) { Keyval kv = (Keyval) args.Get_at(i); if (String_.Eq(k, kv.Key())) return kv.Val(); } } if (counter >= args.Count()) return Nil; for (int i = 0; i < args.Count(); i++) { Keyval kv = (Keyval) args.Get_at(i); if (String_.Eq(kv.Key(), "") && i >= counter) { counter++; return kv.Val(); } } return Nil; }
public GfoMsg Args_ovr(String k, Object v) { if (args == null) args = List_adp_.New(); for (int i = 0; i < args.Count(); i++) { Keyval kv = (Keyval) args.Get_at(i); if (String_.Eq(k, kv.Key())) { kv.Val_(v); return this; } } args.Add(Keyval_.new_(k, v)); return this; }
public String[] ReadStrAryIgnore(String k, String spr, String ignore) { return String_.Split(String_.Replace(ReadStr(k), ignore, ""), spr); }
public String[] ReadStrAry(String k, String spr) { return String_.Split(ReadStr(k), spr); }
public static String Escape_tilde(String v) {return String_.Replace(v, "~", "~~");}
int Compile_eval_cmd(byte[] fmt, int fmt_len, int eval_lhs_bgn, List_adp list) { int eval_lhs_end = Bry_finder.Find_fwd(fmt, char_eval_end, eval_lhs_bgn + Int_.Const_dlm_len, fmt_len); if (eval_lhs_end == Bry_.NotFound) throw Err_mgr._.fmt_(GRP_KEY, "eval_lhs_end_invalid", "could not find eval_lhs_end: ~{0}", String_.new_u8(fmt, eval_lhs_bgn, fmt_len)); byte[] eval_dlm = Bry_.Mid(fmt, eval_lhs_bgn , eval_lhs_end + Int_.Const_dlm_len); int eval_rhs_bgn = Bry_finder.Find_fwd(fmt, eval_dlm , eval_lhs_end + Int_.Const_dlm_len, fmt_len); if (eval_rhs_bgn == Bry_.NotFound) throw Err_mgr._.fmt_(GRP_KEY, "eval_rhs_bgn_invalid", "could not find eval_rhs_bgn: ~{0}", String_.new_u8(fmt, eval_lhs_end, fmt_len)); byte[] eval_cmd = Bry_.Mid(fmt, eval_lhs_end + Int_.Const_dlm_len, eval_rhs_bgn); byte[] eval_rslt = eval_mgr.Eval(eval_cmd); int eval_rhs_end = eval_rhs_bgn + Int_.Const_dlm_len + eval_dlm.length; if (eval_rslt == null) eval_rslt = Bry_.Mid(fmt, eval_lhs_bgn - 2, eval_rhs_end); // not found; return original argument list.Add(Bry_fmtr_itm.dat_bry_(eval_rslt)); return eval_rhs_end; }
public static IptKeyChain parse(String raw) { String[] itms = String_.Split(raw, ","); IptArg[] rv = new IptArg[itms.length]; for (int i = 0; i < rv.length; i++) rv[i] = IptArg_.parse(String_.Trim(itms[i])); return new IptKeyChain(rv); }
public boolean Eq(IptArg comp) { return String_.Eq(key, comp.Key()); }
public void Test_load_page(int ns_id, int page_id, String expd) { Xowe_wiki wiki = bldr_fxt.Wiki(); Xow_ns ns = wiki.Ns_mgr().Ids_get_or_null(ns_id); wiki.Db_mgr_as_sql().Load_mgr().Load_page(actl.Id_(page_id), ns, false); Tfds.Eq(expd, String_.new_a7(actl.Text())); }