I want to make a if where it checks if a Substring is a ". Like here:
char comma = '"'
if(String.Substring(6, 1) == comma)
But this doesnt doesn't work and it gives me this error
Error CS0019 The == operator cannot be used on operands of the type "string" and "char".
Is there an alternative to the char version? String doesnt work either, because the second quotation is ending the first and the 3rd is without end.
If you want to check whether a particular char is at a particular place in a string, treat the string like an array with an index:
Indexing a string returns the char at that place
If you want substrings there is also a new syntax for that:
Prefixing the number with
^means "from the end of the stringYou can mix and match start and end so long as start position is before end position. This string must be at least 10 length:
You can omit the start and it is assumed that you meant 0
You can omit the end and it is assumed you meant ^0
These ranges return strings, not chars