|
|
|||||||
I have tried numerous methods for wildcard to string enumeration and never quite get the desired result. I broadened the net and came across this C# code example. The basics tests I can see but I am at a loss why the increment var++ when its applied to a string. A loop through the chars in the wildcard string compared to the test sting is required so if anyone is a C# coder I really would like to understand these parts translated to kix ! Equally confusing is the definition or an array and value for stopstring ! Code: break on $A=strWildCmp("He??o W*d","Hello World") ? 'Result = '+$A get $ ;http:;www.codeproject.com/Articles/1088/Wildcard-string-compare-globbing 12-Aug-09 4:35 strWildCmp($wildstring,$matchstring) dim $stopstring[1],$wildstringNew $stopstring = '\0' $wildstringNew=$wildstring while($matchstring <> '\0') if ($wildstring = '*') do $wildstring++; EndIf while ($wildstring = '*'); ; if a dork entered two or more * in a row ; ignore them and go ahead if ($wildstring = '\0') ; if * was the last char, the strings are equal $strWildCmp=$matchstring else $stopstring = $wildstring; ; the next char to check after the * EndIf Loop EndIf if($stopstring <> '\0') if(($stopstring = $matchstring) or ($stopstring = '?') ) $wildstring++; $stopstring = '\0'; EndIf matchstring++; else if(($wildstring = $matchstring) or ($wildstring = '?')) $wildstring++; $matchstring++; else if(*$wildstring <> '\0') $wildstring=$wildstringNew; else $strWildCmp='' EndIf EndIf if( ($matchstring = '\0') and ($wildstring <> '\0') ) ; matchstring seems to be too short. Check if $wildstring has any more chars except '*' while ($wildstring = '*') ; ignore following '*' $wildstring++; Loop if ($wildstring = '\0') ; if $wildstring endet after '*', strings are equal $strWildCmp=$matchstring else $strWildCmp='' EndIf EndIf Loop EndFunction |
||||||||
|
|
|||||||
What are you trying to accomplish? This maybe? StringMatch() - do a pattern match against a string http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=132819 How to use UDFs - http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=81943#Post81943 The rest of the UDFs are here - http://www.kixtart.org/forums/ubbthreads.php?ubb=postlist&Board=7&page=1 |
||||||||
|
|
|||||||
Yes Lokernos StringMatch is good however I am dealing with Unicode not necessarily ASCII and am looking for mechanisms and algorithms I can expand into my particular need. I would like to keep it in kixtart or VBS if I can before needing to write EXE or DLL com components which would then need distributing and installing....I appreciate KIX by default uses ASCII. What Intrigues me from a coding perspective is HOW to interpret the VAR++ in a KIX environment rather than just the substitutions of wildcards ! |
||||||||
|
|
|||||||
I didn't even remember writing that. The ++ functionality equivalent for kixtart should be substr() Now, dealing with Unicode is a bit trickier. I remember something like, you can read and write Unicode with some trickery but manipulation I don't remember trying. Or maybe it's easier than I remember. In any case, that code is not directly translatable to kixtart. |
||||||||
|
|
|||||||
This worked well for my reading unicode needs... ReadUnicodeFile - http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=207309#Post207309 |
||||||||
|
|
|||||||
Don't forget this too. Microsoft is sometimes different depending on the tool used. Comparison of Unicode encodings http://en.wikipedia.org/wiki/Comparison_of_Unicode_encodings |
||||||||
|
|
|||||||
Microsoft is or Unicode is? |
||||||||
|
|
|||||||
ALL because they have introduced MAC's into our windows world... Hummm Thanks all |
||||||||
|
|
|||||||
Having to look outside of kix because Dir("Foldername") fails when the folder or file has Unicode in the name - array has text with ? imbedded. ! FSO... |
||||||||
|
|
|||||||
Be sure to check out Dirplus() before you get to far into using FSO... |
||||||||
|
|
|||||||
Lindsay bryce did a great job with DirPlus however using it give upto a 10% CPU hit compared to Dir alone, that said the moment you view the collection with KIX the unicode seems to get taken as a ? so the array still contains un-useable file and folder names. I need to be able to rename the items containing unicode text to ASCII before KIX gets to read them. The problem is HOW as thus far I have not located a scripting method capable of doing this. If when I identify in kix such an entry a script/app could be executed to deal with it in ANO language then I should be able to get past this. |
||||||||
|
|
|||||||
http://superuser.com/questions/636247/how-do-i-remove-non-ascii-characters-from-filenames |