PDA

Показать полную графическую версию : [решено] Сверка переменных по маске


meateron
12-09-2012, 16:46
имеются переменные $a, $b - допустим, $a = 12345, $b = 12

необходимо сверить чтобы $b по маске подходил к $a по первым символам, т.е. 12 подойдёт, 1235 - уже нет.


под конец рабочего дня мозг отказывается фунциклировать, подскажите функцию просто, штурмую гугл полчаса уже %)

отбой, stringinstr ._.

madmasles
13-09-2012, 10:48
отбой, stringinstr »Local (http://www.autoitscript.com/autoit3/docs/keywords.htm#Local) $a = 12345, $b = 34, $c = 12
;так корректнее
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) StringLeft (http://autoit-script.ru/autoit3_docs/functions/StringLeft.htm)($a, StringLen (http://autoit-script.ru/autoit3_docs/functions/StringLen.htm)($c)) == $c Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then) ConsoleWrite (http://autoit-script.ru/autoit3_docs/functions/ConsoleWrite.htm)('OK' & @LF (http://autoit-script.ru/autoit3_docs/macros.htm#@lf))
;чем так
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) StringInStr (http://autoit-script.ru/autoit3_docs/functions/StringInStr.htm)($a, $b) Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then) ConsoleWrite (http://autoit-script.ru/autoit3_docs/functions/ConsoleWrite.htm)('OK' & @LF (http://autoit-script.ru/autoit3_docs/macros.htm#@lf))




© OSzone.net 2001-2012