5 ms·
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 l
by usmannk 2y ago
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.
- codr7 2y agoNah, 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.
- tarentel 2y agoI 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.
- codr7 2y agoI'm curious, any specific examples you can remember?
- mattdw 2y agoI 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 https://developer.apple.com/documentation/foundation/scanner