Last active
April 28, 2018 03:37
-
-
Save Hunachi/dcd698e37294b055e26e4a616f7e25e8 to your computer and use it in GitHub Desktop.
conppassの発表者リストをコピペして実行するとmark downの表を返してくれる.
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
/*入力の終わりには ~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