C
C#3y ago
Doombox

Correctly reading tabs from text file. [Answered]

I have some Markdown files that are just this
- Some Item
- Some Tabbed Item
- Some Item
- Some Tabbed Item
and I'm reading them like this
if (!SemanticVersion.TryParse(file[path.Length..^3], out var semVer)) continue;
await using var stream = _assembly.GetManifestResourceStream(file);
if (stream is null) continue;
using var reader = new StreamReader(stream);
changelogs.Add(semVer, await reader.ReadToEndAsync());
if (!SemanticVersion.TryParse(file[path.Length..^3], out var semVer)) continue;
await using var stream = _assembly.GetManifestResourceStream(file);
if (stream is null) continue;
using var reader = new StreamReader(stream);
changelogs.Add(semVer, await reader.ReadToEndAsync());
however the tabbed items are having their tabs stripped from them and the output is just a bunch of strings split by \r\n, not sure how I'm supposed to read it correctly to preserve the tabs
3 Replies
Doombox
DoomboxOP3y ago
this is how the output looks, in the first item - test should have a tab in front of it
Doombox
DoomboxOP3y ago
for some reason it just replaces \t with , a solution that works for me in this use cause it just to replace all double whitespaces with \t, which isn't ideal but it works for this
Accord
Accord3y ago
✅ This post has been marked as answered!
Want results from more Discord servers?
Add your server