Java tutorial
//package com.java2s; import java.util.HashMap; import java.util.Map; public class Main { public static Map parseIni(String s) { Object obj; if (s == null || s.length() <= 0) { obj = null; } else { obj = new HashMap(); String as[] = s.split("\n"); int i = as.length; int j = 0; while (j < i) { String s1 = as[j]; if (s1 != null && s1.length() > 0) { String as1[] = s1.trim().split("=", 2); if (as1 != null && as1.length >= 2) { String s2 = as1[0]; String s3 = as1[1]; if (s2 != null && s2.length() > 0 && s2.matches("^[a-zA-Z0-9_]*")) ((Map) (obj)).put(s2, s3); } } j++; } } return ((Map) (obj)); } }