Created
February 28, 2016 18:48
-
-
Save Samathy/a4f9338f3875f14f637c to your computer and use it in GitHub Desktop.
One change in character completly changes the behaviour of this.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std.string; | |
import std.stdio; | |
void main() | |
{ | |
string s ="string"; | |
string[4] c = ['a','g','t','s']; | |
string[4] d = ["a","g","t","s"]; | |
for (int i = 0; i < c.length; i++) | |
{ | |
writeln(c[i]); //always prints 'agts' | |
writeln(indexOf(s, c[i])); //Always is -1 | |
} | |
for (int i = 0; i < d.length; i++) | |
{ | |
writeln(d[i]); //always prints EITHER 'a','g','t' or 's' | |
writeln(indexOf(s, d[i])); | |
} | |
writeln(c); | |
// prints: | |
// ["agts", "agts", "agts", "agts"] | |
writeln(d); | |
//prints | |
// ["a","g","t","s"] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment