How can I extract an int contained in a string like att249 or berlin32 using sscanf ?
I tried
"%s%d"
Which doesn't work because the %s scan doesn't stop on the 2
How can I extract an int contained in a string like att249 or berlin32 using sscanf ?
I tried
"%s%d"
Which doesn't work because the %s scan doesn't stop on the 2
After asking on the OCaml discord, I got the answer on how to achieve this :
Which works well because
%[^0-9]scan until it encounters a digit.Being a complete beginner in scanf, I don't know if it's the best way to achieve it though.