Page 2 of 2
Fastest way to determine if a string is contained in another
Posted: Fri May 03, 2019 3:29 pm
by FFF
Again, interesting read, thx.
One caveat i found with indexof
? VAR x := "ABC"
? x:IndexOf("AB")
? x:IndexOf("")
You get (also) "0" back, if by chance/oversight your search string was "lost" prior to searching.
You'll get the same with contains, but in is case, i'd preferred an exception for "Empty". Can't imagine a "useful" search with ""...
Fastest way to determine if a string is contained in another
Posted: Fri May 03, 2019 3:42 pm
by SHirsch
Hi Karl,
you should'nt ask if something is 'useful' in the .Net framework. There are many things where you can ask for the use case.
I always look at the docs and don't ask why. I take it as god given or search for something else that is better for my needs.
Stefan
PS:
https://docs.microsoft.com/de-de/dotnet ... em_String_
Fastest way to determine if a string is contained in another
Posted: Fri May 03, 2019 4:01 pm
by FFF
Hi Stefan,
God? Oh my God
I had looked at the docs, thx.
BTW, a good sample how automatic translation can fail:
The english doc version has a sample, described:
..." The following example looks for "n" in "animal"
gets in German:
"Das folgende Beispiel sucht nach "n" in "Tier"
Good, that they at least didn't translate the code
Fastest way to determine if a string is contained in another
Posted: Fri May 03, 2019 4:15 pm
by SHirsch
oh yeah, i mostly do read the english version. To understand the german version I often have to read it three times to understand what is meant.
Fastest way to determine if a string is contained in another
Posted: Fri May 03, 2019 4:17 pm
by lumberjack
FFF wrote:
Good, that they at least didn't translate the code
Grrr and there all my efforts to code in German fails miserably...