DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ IsValidEditboxValue()

bool OptionSelectorSliderSetup::IsValidEditboxValue ( string text)
inlineprotected

См. определение в файле OptionSelectorSlider.c строка 118

119 {
120 TStringArray allowedCharacters = {"0","1","2","3","4","5","6","7","8","9"};
121 for (int i = 0; i < text.Length(); i++)
122 {
123 int foundIndex = allowedCharacters.Find(text.Get(i));
124 if (foundIndex == -1)
125 return false;
126
127 // make sure user input value can not contain zeros only
128 if (i > 0 && text.ToInt() == 0)
129 {
130 return false;
131 }
132 }
133
134 // make sure user input value is in valid percantage range (0 - 100)
135 if (text.ToInt() > 100 || text.ToInt() < 0)
136 {
137 return false;
138 }
139
140 return true;
141 }
array< string > TStringArray
Определения EnScript.c:685
proto native int Length()
Returns length of string.
proto string Get(int index)
Gets n-th character from string.
proto native int ToInt()
Converts string to integer.

Перекрестные ссылки string::Get(), string::Length() и string::ToInt().

Используется в OnChange().