Created
April 12, 2017 13:32
-
-
Save adacola/e6fa75c1b9e5d8c24e4f00b7e4ee50e0 to your computer and use it in GitHub Desktop.
twiplaの参加者一覧のTSVファイルを作成します
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
(* | |
twiplaの参加者一覧のTSVファイルを作成します。 | |
使用方法 | |
twiplaの印刷用ページを表示してページ全体をクリップボードにコピーし、その内容を文字列にしてtwiplaToTsvの引数に渡します。 | |
*) | |
open System | |
let twiplaToTsv (content : string) = | |
let header = "twitter ID\t名前\tDM済みかどうか\t支払い方法\t支払い詳細通知済みかどうか\t支払い済みかどうか" | |
content.Split([|"\r\n"; "\n"; "\r"|], StringSplitOptions.None) |> Seq.skipWhile ((<>) "【参加者リスト】") |> Seq.skip 2 | |
|> Seq.chunkBySize 2 |> Seq.choose (function | |
| [| first; second |] -> sprintf "%s\t%s" (first.Split('\t').[1]) (second.Split('\t').[0]) |> Some | |
| [| "" |] -> None | |
| otherwise -> failwithf "エラー発生。以下の行が不正です : %A" otherwise) | |
|> String.concat "\r\n" | |
|> printfn "%s\r\n%s" header |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment