I'm in the process of creating a GUI for a program I have been working on. I've got most of the main functionality done and I'm now working on a way to load settings from previous runs of the program. To do this I have the GUI create a .txt file when the user submits all their data and settings, and when they run the GUI again they will load their options from this text file (the GUI will find the file on its own as long as the directories they have set up haven't changed). However I'm having some issues splitting the strings in the txt file and I'm not sure where the problem is. Here is the code that's giving me trouble:
String[] options = fileData[3].split("|");
String[] basicOptions = options[0].split(":");
switch (basicOptions[0]) {
case "yes":
trimReadsYesBtn.setSelected(true);
break;
case "no":
trimReadsNoBtn.setSelected(true);
break;
}
When this part of the code is run, fileData[3] contains the string yes:no:no:human:GRCh38:no:yes:cloud:STAR|Star-settings|(other settings separated by "|")|
The settings to the left of the first | are what I am interested in, but for some reason when I split fileData[3] based on "|", the String[] options becomes an array where each value is an individual letter of fileData[3].
Ex: y,e,s,:,n,o etc.
Is something going wrong when I split the string using | as the regex value? Or is there some other problem that I'm not seeing. Any help is appreciated and obviously if I wasn't clear through any of that explanation just let me know. Thank you!
Aucun commentaire:
Enregistrer un commentaire