/// <summary>Gets the first text element in a specified string.</summary> /// <returns>A string containing the first text element in the specified string.</returns> /// <param name="str">The string from which to get the text element. </param> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="str" /> is null. </exception> public static string GetNextTextElement(string str) { if (str == null || str.Length == 0) { throw new ArgumentNullException("string is null"); } return(StringInfo.GetNextTextElement(str, 0)); }
/// <summary>Advances the enumerator to the next text element of the string.</summary> /// <returns>true if the enumerator was successfully advanced to the next text element; false if the enumerator has passed the end of the string.</returns> public bool MoveNext() { this.elementindex = this.index + 1; if (this.elementindex < this.str.Length) { this.element = StringInfo.GetNextTextElement(this.str, this.elementindex); this.index += this.element.Length; return(true); } this.element = null; return(false); }
// Implement the IEnumerator interface. public bool MoveNext() { if (++index < str.Length) { elementIndex = index; element = StringInfo.GetNextTextElement(str, index); index += element.Length - 1; return(true); } else { element = null; return(false); } }
public bool MoveNext() { elementindex = index + 1; if (elementindex < str.Length) { element = StringInfo.GetNextTextElement(str, elementindex); index += element.Length; return(true); } else { element = null; return(false); } }
public static string GetNextTextElement(string str) { return(StringInfo.GetNextTextElement(str, 0)); }