On Thursday, January 7, 2016 at 2:51:54 AM UTC-7, Tomas Lycken wrote:
>
> Does this solve your problem?
>
> julia> startswith(haystack, needle) = haystack[1:length(needle)] == needle;
>
> This is wrong for Unicode needle strings (where length(needle) is not
necessarily equal to the number of code units in haystack), and also
unnecessary, e.g. it will fail for startswith("αβγ", "αβ"). There is a
built-in startswith function in Base that already does this (correctly),
however, so defining your own startswith function is unnecessary.
>
>