【发布时间】:2012-02-08 00:25:52
【问题描述】:
使用objective-c,我希望将不同数量的文本文件解析到SQLite 数据库,然后查询这些数据。文本将采用以下格式:
PokerStars Hand #74875631942: Hold'em No Limit ($0.50/$1.00 USD) - 2012/02/01 17:08:58 ET
Table 'Psyche II' 2-max Seat #2 is the button
Seat 1: demaredemare ($100 in chips)
Seat 2: Bren Stokes ($100 in chips)
Bren Stokes: posts small blind $0.50
demaredemare: posts big blind $1
*** HOLE CARDS ***
Dealt to Bren Stokes [Th 9d]
Bren Stokes: raises $2 to $3
demaredemare: folds
Uncalled bet ($2) returned to Bren Stokes
Bren Stokes collected $2 from pot
Bren Stokes: doesn't show hand
*** SUMMARY ***
Total pot $2 | Rake $0
Seat 1: demaredemare (big blind) folded before Flop
Seat 2: Bren Stokes (button) (small blind) collected ($2)
PokerStars Hand #74875657847: Hold'em No Limit ($0.50/$1.00 USD) - 2012/02/01 17:09:23 ET
Table 'Psyche II' 2-max Seat #1 is the button
Seat 1: demaredemare ($99 in chips)
Seat 2: Bren Stokes ($101 in chips)
demaredemare: posts small blind $0.50
Bren Stokes: posts big blind $1
*** HOLE CARDS ***
Dealt to Bren Stokes [9d Qs]
demaredemare: raises $1 to $2
Bren Stokes: calls $1
*** FLOP *** [Tc Ah 8c]
Bren Stokes: checks
demaredemare: bets $2
Bren Stokes: calls $2
*** TURN *** [Tc Ah 8c] [4c]
Bren Stokes: checks
demaredemare: checks
*** RIVER *** [Tc Ah 8c 4c] [4s]
Bren Stokes: checks
demaredemare: checks
*** SHOW DOWN ***
Bren Stokes: shows [9d Qs] (a pair of Fours)
demaredemare: shows [3d Qh] (a pair of Fours)
Bren Stokes collected $3.82 from pot
demaredemare collected $3.82 from pot
*** SUMMARY ***
Total pot $8 | Rake $0.36
Board [Tc Ah 8c 4c 4s]
Seat 1: demaredemare (button) (small blind) showed [3d Qh] and won ($3.82) with a pair of Fours
Seat 2: Bren Stokes (big blind) showed [9d Qs] and won ($3.82) with a pair of Fours
由于我需要从每一行“提取”不同的信息位,我相信我需要使用解析器来执行此操作?但是我看到了一些代码,例如: NSString stringWithContentsOfFile NSArray 文件内容组件SeparatedByString NSMutableDictionary NSScanner NSBundle ......你们认为最好的解决方法是什么?非常感谢您的帮助。
热爱你的工作!
【问题讨论】:
标签: objective-c sqlite parsing parser-generator