May 09, 2013 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; } } |
Copyright © 1999-2021 by the D Language Foundation