private GetNumCharactersThatFitWithinWidth ( string text, float width ) : int | ||
text | string | |
width | float | |
Результат | int |
private string GetCroppedText(string fullText, float cropWidth, GUIStyle style) { int numCharactersThatFitWithinWidth = style.GetNumCharactersThatFitWithinWidth(fullText, cropWidth); if ((numCharactersThatFitWithinWidth != -1) && ((numCharactersThatFitWithinWidth > 1) && (numCharactersThatFitWithinWidth != fullText.Length))) { return (fullText.Substring(0, numCharactersThatFitWithinWidth - 1) + "…"); } return fullText; }
private string GetCroppedText(string fullText, float cropWidth, GUIStyle style) { int thatFitWithinWidth = style.GetNumCharactersThatFitWithinWidth(fullText, cropWidth); if (thatFitWithinWidth == -1 || thatFitWithinWidth <= 1 || thatFitWithinWidth == fullText.Length) return fullText; return fullText.Substring(0, thatFitWithinWidth - 1) + "…"; }