Re: Re: [VOTE] Voting opens for str_starts_with and ends_with functions

From: Date: Mon, 08 Jul 2019 13:05:20 +0000
Subject: Re: Re: [VOTE] Voting opens for str_starts_with and ends_with functions
Groups: php.internals 
Request: Send a blank email to internals+get-106169@lists.php.net to get a copy of this message
Please don't switch behaviours via flags: separate names and implementations are much clearer and much simpler to follow. 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 worse 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 = 0, ignoreCase: Boolean = false): Boolean R startsWith(str, pattern, trim=FALSE, ignore.case=FALSE) 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 “start_index” parameter for start_with functions. So… As I say - this is good rfc in perspective, but more discussion is needed.

« previous php.internals (#106169) next »