MimeKit.Header.WordBreak C# (CSharp) Method

WordBreak() static private method

static private WordBreak ( MimeKit.FormatOptions format, string word, int lineLength ) : IEnumerable
format MimeKit.FormatOptions
word string
lineLength int
return IEnumerable
		static IEnumerable<BrokenWord> WordBreak (FormatOptions format, string word, int lineLength)
		{
			var chars = word.ToCharArray ();
			int startIndex = 0;

			lineLength = Math.Max (lineLength, 1);

			while (startIndex < word.Length) {
				int length = Math.Min (format.MaxLineLength - lineLength, word.Length - startIndex);

				if (char.IsSurrogatePair (word, startIndex + length - 1))
					length--;

				yield return new BrokenWord (chars, startIndex, length);

				startIndex += length;
				lineLength = 1;
			}

			yield break;
		}