Recommended way to compare / work with substrings?

Samuel Lampa samuel.lampa at gmail.com
Wed May 8 20:59:05 PDT 2013


What is the recommended way to compare substrings (even of one character 
long)?

I was wondering whetherI'm missing something when doing [1]:

!(cast(string)myString[0..1] == ">"

?

BR
// Samuel


[1] Longer context:

string sequence = "";
File file = File("some_file_with_dna_sequences.txt","r");
while (!file.eof()) {
     string line = chomp(file.readln());
     if (line.length > 0 && !(cast(string)line[0..1] == ">")) {
         sequence ~= line;
     }
}





More information about the Digitalmars-d-learn mailing list