October 04, 2004 std.string.ifind | ||||
---|---|---|---|---|
| ||||
The code below ...
<code>
import std.string;
import std.stdio;
void main()
{
char[] A;
char[] B;
A = "14";
B = "013";
writefln("i Found '%s' in '%s' at %d", A, B, std.string.ifind(B,A));
writefln("s Found '%s' in '%s' at %d", A, B, std.string.find(B,A));
}
</code>
gives ...
# c:\temp>test
# i Found '14' in '013' at 2
# s Found '14' in '013' at -1
In general, whenever the first character in the substring is found in the
string at position (string.length - substr.length + 1), ifind() fails.
--
Derek
Melbourne, Australia
4/10/2004 12:53:38 PM
|
Copyright © 1999-2021 by the D Language Foundation