Skip to content

Instantly share code, notes, and snippets.

@Hunachi
Last active April 28, 2018 03:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hunachi/dcd698e37294b055e26e4a616f7e25e8 to your computer and use it in GitHub Desktop.
Save Hunachi/dcd698e37294b055e26e4a616f7e25e8 to your computer and use it in GitHub Desktop.
conppassの発表者リストをコピペして実行するとmark downの表を返してくれる.
/*入力の終わりには ~FIN~ と入力してください.*/
private fun makeList() {
val presenterList = mutableListOf<String>()
//it find presenter name.
loop@ while (true) {
val input = readLine()
when {
input?.contains("~FIN~", false)!! -> break@loop
input.contains("発表枠 Attendees", false) ->
clipPresenterName(input).let { if (it != "people") presenterList.add(it) }
}
}
presenterList.shuffle()
println("\n" + "| 順番 | 発表者 |\n" + "|:----:|:----:|")
// 1 index.
presenterList.forEachIndexed { i, s ->
println("| ${i + 1} | $s |")
}
}
private fun clipPresenterName(str: String): String {
var name = ""
for (c in str.lastIndex downTo 0) {
if (str[c] == ' ') {
name = str.substring(c + 1, str.length)
break
}
}
return name
}
fun main(args: Array<String>) {
makeList()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment