/// ------------------------------------------------------------------------------------ /// <summary> /// Returns the last word in this TsString where a word is defined as separated by /// whitespace or run breaks, whichever is shorter. /// </summary> /// ------------------------------------------------------------------------------------ public static TsRunPart LastWord(this ITsString tss) { for (int irun = tss.RunCount - 1; irun >= 0; irun--) { TsRunPart lastWord = (new TsRunPart(tss, irun)).LastWord(); if (lastWord != null) { return(lastWord); } } return(null); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="TsRunPart"/> class representing a /// part of the specified TsString. /// </summary> /// <param name="partBase">The part (typically corresponding to a full run) this part is /// a piece of.</param> /// <param name="ichMin">The character position where the part starts.</param> /// <param name="ichLim">The character limit where the part ends.</param> /// ------------------------------------------------------------------------------------ private TsRunPart(TsRunPart partBase, int ichMin, int ichLim) : base(partBase.m_tssBase, ichMin, ichLim) { m_irun = partBase.m_irun; m_props = partBase.Props; // Use property accessor for efficiency }