Skip to content

Instantly share code, notes, and snippets.

View svickers's full-sized avatar

Scott Vickers svickers

View GitHub Profile
@svickers
svickers / gist:33169b52c57403c88d15
Last active August 29, 2015 14:03 — forked from concept47/gist:5295522
Better ES fragments, ported to c#
private string ellipsesForHighlights(string highlight, string original)
{
//remove html in highlight
string stripped_highlighted_item = StripHtml(highlight);
// if the beginning of the highlighted text doesn't match the original, it has been clipped
int tmp = original.IndexOf(stripped_highlighted_item);
bool front_ellipsis = tmp != 0;
// if the last 10 characters of the highlighted text doesn't match the original, it has been clipped