How to parse an input and assign different values to the split string

前端 未结 1 1713
暗喜
暗喜 2021-01-26 01:18

Im trying to create a roman numeral calculator and am unsure how I would parse a user input into 3 parts the first roman numeral the operator and the second numeral while ignori

相关标签:
1条回答
  • 2021-01-26 01:43

    Use the indexof function to find instances of any operators you want to check for. Then take every character to the left of that index (using a substring), and assign it to one value. Take the character at the index and store that as the operator. Take everything that is left and store it as your second roman numeral.

    0 讨论(0)
提交回复
热议问题