Skip to content

Instantly share code, notes, and snippets.

$ curl -v 'http://zsh.com/js/zepto.se.js'
* Trying 121.40.217.132...
* TCP_NODELAY set
* Connected to zsh.com (121.40.217.132) port 80 (#0)
> GET /js/zepto.se.js HTTP/1.1
> Host: zsh.com
> User-Agent: curl/7.56.0
> Accept: */*
>
< HTTP/1.1 200 OK
package com.oxerr.sandbox;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
public class URLEncode {
public static void main(String[] args) throws UnsupportedEncodingException {
public class Main {
private Main m = new Main();
public static void main(String[] args) {
new Main();
}
}
private boolean isValid(String param) {
return param != null && (param.equals("0") || param.equals("1"));
}
private boolean isValid(String... params) {
for (String param : params) {
if (!isValid(param)) {
return false;
}
}
String makeToJsonStr(String str) {
var keys = "label|fieldType|searchType|editHide|addHide|hide|disabled|required|comment|options";
var regex = "(?<key>" + keys + ")\\s*:(?<value>(?:(?!(" + keys + "):).)*)(?<delimiter>[\\,\\}])";
var replacement = "\"${key}\":\"${value}\"${delimiter}";
var replaced = str.replaceAll(regex, replacement);
return replaced;
}