Issues with whitespace #76
Unanswered
fatlazycat
asked this question in
Q&A
Replies: 2 comments 6 replies
-
One way to approach it could be var input = """
41 31 12 14 82
4 97 76 49 15
50 43 72 22 24
53 56 78 33 52
65 68 26 0 94
"""[...].utf8
let output = Many(
Skip(Whitespace())
.take(Int.parser())
.skip(Whitespace())
).parse(&input) |
Beta Was this translation helpful? Give feedback.
1 reply
-
Came up with
My lack of understanding of Strings in Swift seems the main issue 😀 |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Doing AoC 2021 I had the input
How would you parse this ?
If I had
I would just use for each row
But unsure where I would start attempting it where you might have leading whitespace.
I looked to explicitly stating Int.parser() with skipping whitespace but can't seem to grasp it, such as
Thanks
Beta Was this translation helpful? Give feedback.
All reactions