www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Recommended way to compare / work with substrings?

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;
     }
}
May 08 2013