Created
July 5, 2013 06:24
-
-
Save dodyw/5932362 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // parse nik | |
| Pattern p = Pattern.compile("([0-9]+)"); | |
| Matcher m = p.matcher(nik_); | |
| while (m.find()) { // Find each match in turn; String can't do this. | |
| nik += m.group(1) + ""; | |
| } | |
| // parse rt rw | |
| p = Pattern.compile("([0-9]+)"); | |
| m = p.matcher(rt); | |
| int i=0; | |
| while (m.find()) { // Find each match in turn; String can't do this. | |
| if (i==0) rt = m.group(1); | |
| if (i==1) rw = m.group(1); | |
| i++; | |
| } | |
| // parse kode pos | |
| p = Pattern.compile("([0-9]{5})"); | |
| m = p.matcher(kodePos); | |
| while (m.find()) { // Find each match in turn; String can't do this. | |
| kodePos = m.group(1); | |
| } | |
| // parse kota | |
| kota = cleanupText(kota); | |
| arr = Arrays.asList(kota.split("([0-9]{1})")); | |
| kota = arr.get(0).trim(); | |
| // parse status kawin | |
| p = Pattern.compile("TIDAK"); | |
| m = p.matcher(statusKawin_); | |
| boolean kawin = true; | |
| while (m.find()) { // Find each match in turn; String can't do this. | |
| kawin = false; | |
| } | |
| if (kawin) { | |
| statusKawin = "KAWIN"; | |
| } | |
| else { | |
| statusKawin = "TIDAK KAWIN"; | |
| } | |
| // pekerjaan | |
| pekerjaan = cleanupNonAlphanumeric(pekerjaan); | |
| // desa, kecamatan, kota | |
| desa = cleanupNonAlphanumeric(desa); | |
| kecamatan = cleanupNonAlphanumeric(kecamatan); | |
| kota = cleanupNonAlphanumeric(kota); | |
| // agama: Islam, Kristen, Katolik, Buddha, Hindu, dan Konghucu. | |
| p = Pattern.compile("Islam"); | |
| m = p.matcher(agama); | |
| while (m.find()) { | |
| agama = "Islam"; | |
| } | |
| p = Pattern.compile("Kristen"); | |
| m = p.matcher(agama); | |
| while (m.find()) { | |
| agama = "Kristen"; | |
| } | |
| p = Pattern.compile("Katolik"); | |
| m = p.matcher(agama); | |
| while (m.find()) { | |
| agama = "Katolik"; | |
| } | |
| p = Pattern.compile("Budha"); | |
| m = p.matcher(agama); | |
| while (m.find()) { | |
| agama = "Budha"; | |
| } | |
| p = Pattern.compile("Hindu"); | |
| m = p.matcher(agama); | |
| while (m.find()) { | |
| agama = "Hindu"; | |
| } | |
| p = Pattern.compile("Konghucu"); | |
| m = p.matcher(agama); | |
| while (m.find()) { | |
| agama = "Konghucu"; | |
| } | |
| // tempat, tgl lahir | |
| arr = Arrays.asList(tempatLahir.split("([0-9]{1})")); | |
| tempatLahir = arr.get(0).trim(); | |
| tempatLahir = tempatLahir.replaceAll("[^A-Za-z0-9\\s]", ""); | |
| tanggalLahir = cleanupText(tanggalLahir_).replaceAll(tempatLahir, ""); | |
| tanggalLahir = tanggalLahir.replaceAll("[^A-Za-z0-9\\s]", ""); | |
| // propinsi | |
| arr = Arrays.asList(provinsi.split(" ")); | |
| provinsi = provinsi.replaceAll(arr.get(0), "").replaceAll("[^A-Za-z0-9\\s]", ""); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment