Where the error ? (!=) (<>)

sdvcn sdvcn at 126.com
Sun Apr 13 19:38:15 PDT 2014


dstring key = "<"d;
dstring str = "<盗墓笔记>"d;

	for(size_t i;i<str.length;)
	{
		bool bh = true;

		foreach(dchar kv;key)
		{
			dchar t = cast(dchar)tstr[i++]; // 0x3c
			dchar ta = 0x3c;
			//if(str[i++] != kv)           //kv : 0x3c
			//if(t == ta)                // Should return true
			//if(t <> ta)                // Should return false
			if(t != ta)                // Should return false
			{
				// All returns true ?????****
				bh = false;
				i += key.length;
				break;
			};
		}
	}

"if(t <> ta)" No right to judge
"if(t != ta)" No right to judge


More information about the Digitalmars-d mailing list