C
C#8mo ago
TactiCool

IndexOf being weird? (Advent of Code day1 semi-spoiler?)

Okay I don't even know how to ask outside of "why?" Why does this not find the index
No description
24 Replies
TactiCool
TactiCool8mo ago
sry I can get you the code in a sec, just I'm watching my friend code on a screenshare atm xD
Jimmacle
Jimmacle8mo ago
is it your code or your friend's code? would be easier to help them directly
TactiCool
TactiCool8mo ago
it's an error that came up while we were brainstorming Advent of Code together, but it's her code, I'll get her in the server in a sec just she is afk for a moment it's really just 3 lines and I have no clue why indexof behaves like this
Jimmacle
Jimmacle8mo ago
is the code being run the same as the code we're looking at?
TactiCool
TactiCool8mo ago
yes
Jimmacle
Jimmacle8mo ago
as in, are you sure the file is saved, the build succeeded, etc
TactiCool
TactiCool8mo ago
yea, all of it went through green we just made this file to see if the code/bug reproduces in a completely clean enviroment
Jimmacle
Jimmacle8mo ago
the reason i'm asking is because the code shown is correct and works on my PC
TactiCool
TactiCool8mo ago
so there is some other weird innate problem there huh or like "more in depth"
Jimmacle
Jimmacle8mo ago
somehow you aren't running the code you think you are
TactiCool
TactiCool8mo ago
hmmm
TactiCool
TactiCool8mo ago
I don't know if a full shot of the screen helps in like "hah there should be another thing written"
No description
TactiCool
TactiCool8mo ago
but yea we'll be looking around, ty for confirming that the code works on other machines (yea we just copied into an online interpreter and that worked too, damn) she just confirmed that it is a fresh install of visual studio on the pc (one was installed previously, but it has been completely uninstalled before this)
MODiX
MODiX8mo ago
TheRanger
REPL Result: Success
string a = "fbkzzsixgshhmzdgt9";
string six = "six";
Console.WriteLine(a.IndexOf(six));
string a = "fbkzzsixgshhmzdgt9";
string six = "six";
Console.WriteLine(a.IndexOf(six));
Console Output
5
5
Compile: 466.045ms | Execution: 28.790ms | React with ❌ to remove this embed.
TheRanger
TheRanger8mo ago
works fine
TactiCool
TactiCool8mo ago
yea for some weird reason, it works everywhere except on her pc xD
TheRanger
TheRanger8mo ago
is the screenshot from her pc?
Asaph
Asaph8mo ago
Pobiega
Pobiega8mo ago
is the computer perhaps running turkish locale? I know their locale has issues with specifically lowercase i
mtreit
mtreit8mo ago
Oh god. The Turkish I problem. <flashbacks> Use ordinal compare if at all possible Or at least InvariantCulture
TheRanger
TheRanger8mo ago
ur saying this exact code returns -1 in turkish locale?
mtreit
mtreit8mo ago
I'm actually skeptical it's the Turkish I problem because it's such a rare edge case
TheRanger
TheRanger8mo ago
if thats really the problem then ig thats not exactly the code their friend ran
Jimmacle
Jimmacle8mo ago
this is why screenshots are bad when
Want results from more Discord servers?
Add your server
More Posts