Cant convert HEX

I'm trying to convert this color " #E5AA70" not sure why when it run through r it get this error
12 Replies
MODiX
MODiX3y ago
Angius#1586
REPL Result: Success
int.Parse("FA75C7", System.Globalization.NumberStyles.HexNumber)
int.Parse("FA75C7", System.Globalization.NumberStyles.HexNumber)
Result: int
16414151
16414151
Compile: 473.281ms | Execution: 21.937ms | React with ❌ to remove this embed.
Angius
Angius3y ago
This is sus in your example
Angius
Angius3y ago
Looks like leading whitespace
TotechsStrypper
TotechsStrypperOP3y ago
okay let me see
Angius
Angius3y ago
.Trim() it just to make sure
TotechsStrypper
TotechsStrypperOP3y ago
I think there is
TotechsStrypper
TotechsStrypperOP3y ago
like this ?
Angius
Angius3y ago
hex = hex.Replace(...).Trim();
TotechsStrypper
TotechsStrypperOP3y ago
it work thanks weird avatar anime guy (send me the girl name would be awesome)
Angius
Angius3y ago
Tanya Degurechaff from Youjo Senki
Groophy
Groophy3y ago
@TotechsStrypper Better way you can use
hex = hex.TrimStart('#');
hex = hex.TrimStart('#');
Angius
Angius3y ago
Yeah, that'd probably be better Assuming there's no whitespace anywhere else

Did you find this page helpful?