-
[RESOLVED] permeate case
So i'm still working on my music sorter, and i've encountered another slight issue with the case of extensions.
I'm using
Code:
My.Computer.FileSystem.GetFiles(PATH, FileIO.SearchOption.SearchAllSubDirectories, FORMATS)
to get at the files, but since this is done with a string for the formats, i need to be able to get each permutation of the case of each format
so if it's *.mp3, i'll also get *.Mp3, *.mP3, and *.MP3
I've tried any number of things, but what i would like to do is accumulate to a variable so i can return a great big string containing all of the various case permutations
Code:
For Each element In inputArray
For Each i In element
'what do i do here :(
Next
MessageBox.Show(element)
Next
and i'd still like to know how to embed the dll in my exe
-
Re: permeate case
Are you sure the format (wildcard pattern actually) is case-sensitive? I can't imagine that. If it is, you can always use System.IO.Directory.GetFiles instead, which I'm pretty sure is not case-sensitive.
Obviously if the pattern is not case-sensitive, then mp3, Mp3, mP3, etc are all considered equal and you don't need to use them all, you just use one of them.
-
Re: permeate case
Yeah, I've put it to the test myself, but because its comparing part of the file name to string data, it wont pull it if the file itself doesn't match the string with case as well. it would be great if it had an option to ignore case :P
and i get the same results...or lack of results with System.IO.Directory.GetFiles
:(
thanks for trying though! :D
-
Re: permeate case
any other suggestions or ideas. i've managed to get the inversion cases and the all upper and all lower cases this way with code like this
Code:
For Each ext In inputArray
ext = ext.ToUpper & ext.ToLower
For Each i In ext
If acounter Mod 2 = 0 Then
a += i.ToString.ToUpper
Else
a += i.ToString.ToLower
End If
acounter += 1
If bcounter Mod 2 = 0 Then
b += i.ToString.ToLower
Else
b += i.ToString.ToUpper
End If
bcounter += 1
Next
ext += a + b
MessageBox.Show(ext)
Next
but i can't for the life of me think of a good way to get the case pairs like ABc and aBC
-
Re: permeate case
I still stand by my first post: the pattern argument of the GetFiles function is not case-sensitive.
Proof:
http://i50.tinypic.com/116qejq.png
I've got 5 text files, each with a ".txt" extension in different casings. You can see my code in action: it uses System.IO.Directory.GetFiles with a "*.txt" search pattern, and it finds all 5 files.
-
Re: permeate case
The My.Computer.FileSystem.GetFiles isn't case-sensitive either. Internally, the My.Computer.FileSystem.GetFiles and System.IO.Directory.GetFiles use the same class and methods (though I'm not 100% sure).
-
Re: permeate case
ahhhh, i see. in my get tag function i was also comparing the extension of the file sent, to a format variable, which is built from a textbox and a few predefined formats, and that comparison was where it was breaking down.
thank you gentlemen for all of your help. i do feel like a dunce for missing it now though :P
Thanks ^_^