fun string2HashMap(paramString: String): HashMap<String, String>? { val params: HashMap<String, String> = HashMap() for (keyValue in paramString.split(" *& *".toRegex()).dropLastWhile { it.isEmpty() } .toTypedArray()) { val pairs = keyValue.split(" *= *".toRegex(), limit = 2).toTypedArray() params[pairs[0]] = if (pairs.size == 1) "" else pairs[1] } return params }
Convert key=value type String to HashMap < String , String >