public static JsString addTimeToUrl(JsString url) { if (-1 == url.indexOf("?")) { url += "?" + "time=" + (new JsDate()).getTime(); } else { url += "&" + "time=" + (new JsDate()).getTime(); } return url; }
public static bool StartsWith(this JsString s, JsString find) { return(s.indexOf(find) == 0); }
public static bool Contains(this JsString s, JsString find) { return(s.indexOf(find) >= 0); }
public string GetPrefix(JsString prop) { JsString prefix = ""; int idx = prop.indexOf("."); if (-1 != idx) { prefix = prop.substr(0, idx + 1); } return prefix; }
public bool HasPrefix(JsString prop) { bool res = false; int idx = prop.indexOf("."); if (-1 != idx) { res = true; } return res; }
public string getQueryParam(JsString jsString, string p) { string res = ""; int idx = jsString.indexOf("?"); if (idx > 0) { JsString tmp = jsString.substr(idx + 1); JsArray<JsString> args = tmp.split("&"); if (args.length == 0) { args.Add(tmp); } foreach (JsString arg in args) { JsArray<JsString> keyVal = arg.split("="); if (keyVal.length == 2) { if (keyVal[0] == p) { res = keyVal[1]; break; } } } } return res; }
public string getPrefix(JsString tmp) { int idx = tmp.indexOf("."); string prefix = tmp.substr(0, idx + 1); return prefix; }