I am splitting a string which contains a filename from a windows system. The string uses the ascii FS to separate the filename from other information
e.g. filename.jpgFSotherInformationFSanotherPartOfInformation
Here some example code:
String fs = new String(new byte[]{(byte)32});
String information ="filename (copy).jpg"+fs+"otherInformation";
String[] parts = information.split(fs);
Why does split confuse the space-separator with the ascii-FS?
Should I use a different function that split? Pattern.quote(fs) does help either... :-(
Because FS is not ascii value 32.
http://bestofthisweb.com/blogs/tag/ascii-table/
The FS
is character 28, but this control character should not be used in file names, only for some rare binary file formats (I don't know of one which uses it anymore)
The space character is 32 which is why it looks the same the split, because it is.
For a simple field seperator, I suggest you use ',' or '\t' which can be easily read as text or using a spreadsheet package.
I would suggest stepping through the code in a debugger so you can see what you program is doing.