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.

Reply via email to