Skip to content

Instantly share code, notes, and snippets.

@bga
Created October 25, 2010 14:57
Show Gist options
  • Save bga/645082 to your computer and use it in GitHub Desktop.
Save bga/645082 to your computer and use it in GitHub Desktop.
String String::slice(Int begin, Int end)
{
String a;
// calculate real begin and end
a.begin = buffer->begin + begin;
a.length = end - begin;
a.buffer = buffer;
buffer->refCount++;
return a;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment