Go to file
Parnic 483f1f2502 Strip more BOMs
The 01a sample text file I created in VS2022 has a big-endian utf-16 byte order mark in front. When read with File.Read* methods it was fine, but when piped in from the command line it was causing the integer parsing to fail due to the extra bytes on the front. This is the cleanest way I can find to strip any of a set of BOMs from a string. Maybe there's an easier way somewhere, but the main issue is that using something like line[0..1].SequenceEqual() may or may not use wide chars (0xFEFF as opposed to 0xFE, 0xFF, for example) so I can't just build a list of preamble arrays and check if the byte version of the string starts with them.

The "StripPreamble" character list is still a mystery. I found it while working on my Macbook for aoc2021 and can't seem to find any search results indicating what these bytes represent, so...just gonna leave it there.
2022-12-01 11:59:43 -06:00
2022-12-01 08:48:36 -06:00
2022-11-30 17:19:53 -06:00
2022-12-01 11:59:43 -06:00
2022-11-30 17:19:53 -06:00
2022-11-30 17:19:53 -06:00

Advent of Code 2022

My solutions to Advent of Code 2022.

Description
No description provided
Readme 302 KiB
Languages
C# 100%