This seems stupid – must be me!
Say I had a string filter["size]" = "g1g" this actually reads “greater” “1” “gb”
so
I’ve done a test to see if “first” character is a character, and work out its greater
I’ve done a test to see if “last” character is a character, and work out its gb, or mb, or whatever
first and last are both boolean.
I then set x (cos I was getting stroppy) to length of filter[“size”] which is a string.
However, I’ve come to copy the final number(s) in the middle.
Int64.Parse(filter["size"].Substring(first?1:0,last?(first?x-2:x-1):x));
And it doesnt like the nested inline ifs..
Substring(first?1:0,last?(first?x-2:x-1)); complains that its missing the :, which is right, but the instant you add it it complains
Error 1 The best overloaded method match for 'string.Substring(int, int)' has some invalid arguments
Im beginning to think I should just have parsed it with regexpr, but now Im curious as to why this isnt working.
So, irrelevant of there could be a ton of better ways, can anyone tell me why these nested inline ifs dont work?
Your code is perfectly compilable as you’ve described it, if horrendously readable. Filling out your blanks, I tried this:
This code results in
resultbeing set to123456. No errors, no problems.There is something wrong with your surrounding code; your ternary expressions are fine.