C
C#12mo 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
TactiCoolOP12mo ago
sry I can get you the code in a sec, just I'm watching my friend code on a screenshare atm xD
Jimmacle
Jimmacle12mo ago
is it your code or your friend's code? would be easier to help them directly
TactiCool
TactiCoolOP12mo 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
Jimmacle12mo ago
is the code being run the same as the code we're looking at?
TactiCool
TactiCoolOP12mo ago
yes
Jimmacle
Jimmacle12mo ago
as in, are you sure the file is saved, the build succeeded, etc
TactiCool
TactiCoolOP12mo 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
Jimmacle12mo ago
the reason i'm asking is because the code shown is correct and works on my PC
TactiCool
TactiCoolOP12mo ago
so there is some other weird innate problem there huh or like "more in depth"
Jimmacle
Jimmacle12mo ago
somehow you aren't running the code you think you are
TactiCool
TactiCoolOP12mo ago
hmmm
TactiCool
TactiCoolOP12mo 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
TactiCoolOP12mo 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
MODiX12mo 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
TheRanger12mo ago
works fine
TactiCool
TactiCoolOP12mo ago
yea for some weird reason, it works everywhere except on her pc xD
TheRanger
TheRanger12mo ago
is the screenshot from her pc?
Asaph
Asaph12mo ago
Pobiega
Pobiega12mo ago
is the computer perhaps running turkish locale? I know their locale has issues with specifically lowercase i
mtreit
mtreit12mo ago
Oh god. The Turkish I problem. <flashbacks> Use ordinal compare if at all possible Or at least InvariantCulture
TheRanger
TheRanger12mo ago
ur saying this exact code returns -1 in turkish locale?
mtreit
mtreit12mo ago
I'm actually skeptical it's the Turkish I problem because it's such a rare edge case
TheRanger
TheRanger12mo ago
if thats really the problem then ig thats not exactly the code their friend ran
Jimmacle
Jimmacle12mo ago
this is why screenshots are bad when
Want results from more Discord servers?
Add your server