Created
November 20, 2022 17:38
-
-
Save MostafaGad1911/cf6a6702aae660ca799defd4a468824f to your computer and use it in GitHub Desktop.
This file contains 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
val log_dump = | |
"name=Dan B, username=db, email=db@gmail.com, id=123; name=Hannah, username=hsmith, id=333, email=hsm@test.com; name=Dan Brick, username=db, email=db@gmail.com, id=663;" | |
val toTypedArray = log_dump.split(";").toTypedArray().filter { it.isNotEmpty() } | |
val filtered:ArrayList<String> = ArrayList() | |
for (item in toTypedArray) { | |
item.replace("${item.substringBefore(", id=").substringBefore(",")}", "") | |
Log.i("GadTest1", "$item") | |
} | |
toTypedArray?.forEachIndexed { index, data -> | |
if (index > 0){ | |
if (!filtered.contains(data.substringAfter("username=").substringBefore(";"))) | |
filtered.add(data) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment