Skip to content

Instantly share code, notes, and snippets.

@ScottKaye
Created January 17, 2017 03:15
Show Gist options
  • Save ScottKaye/dd16e23c6ab9c54195e33ace5f51fd70 to your computer and use it in GitHub Desktop.
Save ScottKaye/dd16e23c6ab9c54195e33ace5f51fd70 to your computer and use it in GitHub Desktop.
void Main()
{
string input = Console.ReadLine();
input.EatHorror("abcdefg");
input.Dump("Eaten");
(input + " - Appended").Dump("Fix?");
"hello".Dump("Try entering \"hello\"");
}
public static class Ext
{
// Unspeakable things
public static unsafe void EatHorror(this string s, string r)
{
fixed (char* c = string.Intern(s)) for (int i = 0; i < Math.Min(s.Length, r.Length); c[i] = r[i++]) ;
}
}
@ScottKaye
Copy link
Author

ScottKaye commented Jan 17, 2017

Example where input was hello.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment