Second Round CURL Wrapper Review
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon Dec 12 06:42:17 PST 2011
On 12/12/11 6:25 AM, jdrewsen wrote:
> On Monday, 12 December 2011 at 01:05:25 UTC, Jonathan M Davis wrote:
>> On Sunday, December 11, 2011 19:55:28 dsimcha wrote:
>>> On 12/11/2011 7:53 PM, dsimcha wrote:
>>> > Should the protocol detection be case-insensitive, i.e. > "ftp://" ==
>>> > "FTP://"?
>>>
>>> Oh, one more thing: Factor the protocol detection out into a function.
>>> You have the same expression cut and pasted everywhere:
>>>
>>> if(url.startsWith("ftp://") || url.startsWith("ftps://") ...
>>
>> And startsWith will take multiple arguments, so the code definitely
>> shouldn't have
>>
>> x.startsWith(y) || x.startsWith(z) || ...
>>
>> It's more verbose and less efficient that way.
>>
>> - Jonathan M Davis
>
> I hadn't noticed that multiple arguments is accepted. Thanks.
> /Jonas
You can also pass a predicate for case insensitive comparison.
Andrei
More information about the Digitalmars-d
mailing list