Epigene.UI.UIText.BreakLine C# (CSharp) Метод

BreakLine() приватный статический Метод

Locates position to break the given line so as to avoid breaking words.
private static BreakLine ( string text, int pos, int max ) : int
text string String that contains line of text
pos int Index where line of text starts
max int Maximum line length
Результат int
		private static int BreakLine(string text, int pos, int max)
		{
			// Find last whitespace in line
			int i = max;
			while (i >= 0 && !Char.IsWhiteSpace(text[pos + i]))
				i--;
			
			// If no whitespace found, break at maximum length
			if (i < 0)
				return max;
			
			// Find start of whitespace
			while (i >= 0 && Char.IsWhiteSpace(text[pos + i]))
				i--;
			
			// Return length of text before whitespace
			return i + 1;

		}//BrakeLine