Skip to content

Instantly share code, notes, and snippets.

View smourier's full-sized avatar

Simon Mourier smourier

View GitHub Profile
@smourier
smourier / NumberedNoWrappedTxtBooks.cs
Created March 30, 2025 05:45
Creates a numbered, unwrapped versions of .txt books (for the ones like in project gutenberg https://www.gutenberg.org/)
public static void Main(string[] args)
{
var path = @"C:\Users\bob\Downloads\AliceInWonderland.txt";
path = @"C:\Users\bob\Downloads\Frankenstein.txt";
path = @"C:\Users\bob\Downloads\MobyDick.txt";
var text = File.ReadAllText(path);
// add numbers in front of each line
var lines = text.Split(["\r\n", "\n"], StringSplitOptions.None);
var digits = Math.Floor(Math.Log10(lines.Length) + 1);