Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106169 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 22943 invoked from network); 8 Jul 2019 15:46:00 -0000 Received: from unknown (HELO mxout3.rambler.ru) (81.19.78.102) by pb1.pair.com with SMTP; 8 Jul 2019 15:46:00 -0000 Received: from saddam3.rambler.ru (saddam3.rambler.ru [10.32.16.3]) by mxout3.rambler.ru (Postfix) with ESMTP id AF5917C0327; Mon, 8 Jul 2019 16:05:23 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rambler.ru; s=mail; t=1562591123; bh=00khyg6Ci84OWji9gmupWiBPYUrIaNoBre5XOu+ejuA=; h=From:To:Reply-To:Subject:Date; b=gFW5YMXU16NSdUO1C7pRceg90cIoAlq5MYmwMN4YLvimPmr/DaNq6UbI6mAhxIt+b 4nUw/alew0NbfOnFfNGbUZ/beLAzIQxDH0hq3SNrmBCTb3LVpErOGTiUz32azfd0e1 rkeTdQer0Ls5qnqwZ0/BDKRQFE7sqs9Tp2+vr47E= Received: from localhost.localdomain (localhost [127.0.0.1]) by saddam3.rambler.ru (Postfix) with ESMTP id A8579C392EF; Mon, 8 Jul 2019 16:05:20 +0300 (MSK) Received: from [31.173.94.241] by mail.rambler.ru with HTTP; Mon, 8 Jul 2019 16:05:20 +0300 To: "internals" , ocramius@gmail.com Reply-To: "Andrew Gromov" Date: Mon, 8 Jul 2019 16:05:20 +0300 Content-Transfer-Encoding: 7bit Content-Type: multipart/alternative; boundary="_----------=_15625911202302057" Message-ID: <1562591120.659818.23020.47476@mail.rambler.ru> MIME-Version: 1.0 X-Mailer: Rambler WebMail, http://mail.rambler.ru/ X-Rambler-User: andrewgrom@rambler.ru/31.173.94.241 Subject: Re: Re: [VOTE] Voting opens for str_starts_with and ends_with functions From: andrewgrom@rambler.ru ("Andrew Gromov") --_----------=_15625911202302057 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8"; format="flowed" > Please don't switch behaviours via flags: separate names and > implementations are much clearer and much simpler to follow. >=20 > Yes, you will have multiple variations, but that's fine. It is depends of preferences. In my opinion, create new function for every possible situation is more wor= se then use flags. Python str.startswith(prefix[, start[, end]]) -> bool C# public bool StartsWith (string value, bool ignoreCase, System.Globalization.CultureInfo culture); public bool StartsWith (string value, StringComparison comparisonType); JS str.startsWith(searchString[, position]) Kotlin fun String.startsWith(prefix: String, startIndex: Int =3D 0, ignoreCase: Bo= olean =3D false): Boolean R startsWith(str, pattern, trim=3DFALSE, ignore.case=3DFALSE) Scala startsWith[B](that: GenSeq[B], offset: Int): Boolean Golang, java, C++, Ruby, Swift have simples syntax, like string.startsWith(prefix) C#, Kotlin, R uses flag for ignore case. Anyway, I can't find language from various TOP-lists where present separate function for case insensitive operations. Another note - I see that many languages provide =E2=80=9Cstart_index=E2=80= =9D parameter for start_with functions. So=E2=80=A6 As I say - this is good rfc in perspective, but more discussion= is needed. --_----------=_15625911202302057--