![]() |
#1 |
Участник
|
axaptapedia: Match
Источник: http://www.axaptapedia.com/Match
============== Summary: New page: Here is a method for searching (matching) text in the classical style: If for instance the InventTable must be searched for records whos item name contains the text MUSTER, this method ca... Here is a method for searching (matching) text in the classical style: If for instance the InventTable must be searched for records whos item name contains the text MUSTER, this method can be called with the parameters: X++: if (myMatch('*MUSTER*', inventTable.Itemname)) { // Then do something } The method return true if a match was found and false otherwise. X++: static boolean myMatch(str _matchKey, str _text) { str matchKey = _matchKey; str text = _text; str tokKey; // Match Key Token - Holds actual Character being examined str tokText; // Text Token - Holds actual Character being examined str laTok; // Look Ahead Token - Holds Character one Positition after Token Character int lenKey; // Key Length int lenText; // Text Length int incKey; // Incrementor for Key int incText; // Incrementor For Text int laKey; // Look Ahead Incrementor for Key boolean ret = true; ; #define.WC_MANY ('*') #define.WC_ONE ('?') if (!matchKey) matchKey = #WC_MANY; lenKey = strlen(matchKey); lenText = strlen(text); incText = 1; for (incKey = 1; incKey lenText) ret = false; switch (tokKey) { case #WC_MANY : if (incKey < lenKey) { laKey = incKey + 1; laTok = substr(matchKey, laKey, 1); if (strscan(text, laTok, incText, strlen(text))) { incText = strscan(text, laTok, incText, strlen(text)); if (!myMatch( substr(matchKey, incKey + 1, strlen(matchKey)), substr(text, incText, strlen(text)) )) { incKey--; incText++; } else { return true; } } else { return false; } } else { return true; } break; case #WC_ONE : incText++; break; default : if (tokKey == substr(text, incText, 1)) { incText++; } else { return false; } break; } } if (incText < lenText) ret = false; return ret; } Источник: http://www.axaptapedia.com/Match
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
![]() |
||||
Тема | Ответов | |||
axcoder: PowerShell + Ax | 1 | |||
axaptapedia: Load Web Documents | 1 | |||
axaptapedia: Regular expressions | 0 | |||
axcoder: AxPath is supported by axaptapedia | 0 |
|