C# Class TextHelper.Excerptor

ファイルを表示 Open project: tylermercier/TextHelper

Public Methods

Method Description
Excerpt ( this text, string phrase, int radius = 100, string omission = "..." ) : string

Extracts an excerpt from text that matches the first instance of phrase. The resulting string will be stripped in any case.

Private Methods

Method Description
GetExcerptWithOmission ( string text, string phrase, int phraseIndex, int radius, string omission ) : string

Method Details

Excerpt() public static method

Extracts an excerpt from text that matches the first instance of phrase. The resulting string will be stripped in any case.
public static Excerpt ( this text, string phrase, int radius = 100, string omission = "..." ) : string
text this
phrase string The excerpt to find
radius int Expands the excerpt on each side of the first occurrence of phrase by the number of characters defined (default 100).
omission string If the excerpt radius overflows the beginning or end of the text, then the omission option (which defaults to “…”) will be prepended/appended accordingly.
return string