0

I have a string that in plain text is "1:2:3:4". I need to get the individual numbers from the string and then convert them into their own integers to be handled later. How do I extract the numbers from the string sequentially and turn them into their own ints (as in I need 4 different integers). Thank you.

John Kumbi
  • 47
  • 6
  • @NathanOliver: I like your style. That duplicate is the gold standard way - only a reply based on Boost Spirit would be an answer with a steeper learning curve! – Bathsheba Mar 26 '18 at 16:40
  • 1
    Hint: If `s` is the string, then the first integer is `s[0] - '0'`, and the second one `s[2] - '0'`. – Bathsheba Mar 26 '18 at 16:41
  • Hey thanks for the reply! The problem is that this goes up to three digit integers separated by colons. My example wasn't very good. – John Kumbi Mar 26 '18 at 19:54

0 Answers0