BurntSushi / nflgame

An API to retrieve and read NFL Game Center JSON data. It can work with real-time data, which can be used for fantasy football.
http://pdoc.burntsushi.net/nflgame
The Unlicense
1.27k stars 412 forks source link

Parse and format player names with >1 comma #341

Open ariannedee opened 6 years ago

ariannedee commented 6 years ago

Fixes #316 and #214

This will produce: Leno, Charles, Jr.' -> 'Leno', 'Charles Jr.'

name.split(',', 1) -> only splits on the first occurrence of ',' ensuring not more than 2 items s.strip().replace(',', '') -> removes any remaining commas so that it doesn't affect CSVs

The other PRs would produce the following names:

277: 'Leno', 'Charles, Jr.'

266: 'Leno', 'Charles'

Regardless of which fix is best, one of these should really be merged.