There is a string: string a = "<rand()|1|3|2>" .

It is necessary to find this rand() number if it comes before the number < , and immediately after | .

How to do it?

Closed due to the fact that the essence of the question is not clear to the participants 0xdb , aleksandr barakin , Enikeyschik , Kromster , Dmitry Kozlov 22 Nov '18 at 17:54

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • 3
    - Who stood on whom? - shouted Philipp Philippovich, - take the trouble to express your thoughts more clearly. - bipll

1 answer 1

 string a = "<" + to_string(rand()) + "|1|3|2>"; int first = a.find_first_of("|"); string NeW = a.substr(1, first - 1); 
  • And if the number is two-digit? - MBo
  • it is already two-digit - pCoder