示例#1
0
 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, "'", "''");
 }
示例#2
0
  public static String Resolve_file(boolean use_file_protocol, Io_url root_dir, String file) {
    String rv = file;

    // resolve relative urls; EX: "./a.js" -> "/xowa/wiki/simple.wikipedia.org/bin/script/a.js"
    if (String_.Has_at_bgn(rv, "./")) {
      // remove "./"
      rv = String_.Mid(rv, 2);

      if (use_file_protocol) rv = root_dir.To_http_file_str() + rv;
      else {
        // if fsys_url && wnt, replace "\" with "/"
        if (Op_sys.Cur().Tid_is_wnt())
          rv = String_.Replace(rv, Op_sys.Lnx.Fsys_dir_spr_str(), Op_sys.Wnt.Fsys_dir_spr_str());
        rv = root_dir.Xto_api() + Op_sys.Cur().Fsys_dir_spr_str() + rv;
      }
    }
    return rv;
  }
示例#3
0
 public String[] ReadStrAryIgnore(String k, String spr, String ignore) {
   return String_.Split(String_.Replace(ReadStr(k), ignore, ""), spr);
 }
示例#4
0
	public static String Escape_tilde(String v) {return String_.Replace(v, "~", "~~");}