Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

dont you find all the string parsing and manipulation to be quite painful in Swift? I tried to do AoC in Swift before and that put me off a lot. I liked doing little functional one liners but a week from now the parsing burden will be too high.


I found the Scanner API (1) to be pretty handy for the more complex parsing in past years.

It’s Foundation so hopefully also on Linux/Windows, but if not there’s also one on GitHub called SwiftScanner.

1: https://developer.apple.com/documentation/foundation/scanner


I program everyday in Swift. I attempted AoC for the first time in Swift last year and gave up after about a week or so for this exact reason and switched to python for the remainder. I don't want to struggle with the awkward string API to do things other languages can do in a line.


I'm curious, any specific examples you can remember?


Nah, the String type is fine as far as basic functionality goes, I like adding my own convenience stuff in extensions.

The language has been moving pretty fast though, I have a feeling a lot of features I find useful are relatively new.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: