How do I get the length between two chars in a string?
Hey, I am trying to generate a substring starting at pos_of_start and ending at pos_of_end + end_size but I can't figure out how to get the length.
and that worked for a while, but I just found a case where it doesn't work. This is when the result of that operation is 0, because pos_of_start > pos_of_end. pos_of_end is 45, and pos_of_start is 54. So 45 - 54 is -9 and -9 + end_size (which is 9) is 0.
len_of_substr = pos_of_end - pos_of_start + end_size;
Thanks in advance.
EDIT: Wait a sec...pos_of_end should not be less than pos_of_start! I need to figure out why it is...