DZ-Jay wrote:
> Arno Garrels wrote:
>>> From: Vander Clock Stephane
>>
>> [..]
>>
>>> I think you must replace
>>> S := Copy(S, 5, Length(S));
>>>
>>> by
>>> S := Copy(S, 6, Length(S));
>>
>>
>> I don't know why, length of both strings is 5 not 6.
>>
>> Typically the lines in question of a EHLO response look like
>> 250-AUTH=LOGIN CRAM-MD5 PLAIN
>> 250-AUTH CRAM-MD5 LOGIN PLAIN
>
> It depends on whether the Index argument (the second argument to Copy)
> is zero-based or not, and for that matter, Delete() also.
>
> Delete(S, 1, 4);
> if (CompareText(Copy(S, 1, 5), 'AUTH ') = 0) or
> (CompareText(Copy(S, 1, 5), 'AUTH=') = 0) then begin
> S := Copy(S, 5, Length(S));
> {...}
>
> If the Index is not zero-based (starts with 1), then it should be 6,
> otherwise you'd get '=AUTH' or ' AUTH'.
But S is _not_ an array, it is a String type.
At index 0 of a String you have the length.
---
Arno Garrels [TeamICS]
If it is zero-based, then there
> is another problem, since the CompareText calls Copy() with an Index of
> 1, which means that it starts to delete at the second character, not to
> mention the call to Delete() uses an Index of 1 also.
>
> I cannot confirm right now (I do not have Delphi installed on this
> computer) which it is. Arno, can you verify?
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be