'How to filter from text c++

Okay imagine

string a = "msg|`4UPDATE REQUIRED!`` : The `$V3.82`` update is now available for your device.  Go get it!  You'll need to install it before you can play online.";

I want to get the "`$V3.82``" from string a

How can i do that?



Solution 1:[1]

you can use the substr function

#include <iostream>
#include<string>
using namespace std;

int main()
{
        string a = "msg|`4UPDATE REQUIRED!`` : The `$V3.82`` update is now available for your device.  Go get it!  You'll need to install it before you can play online.";
string result = a.substr(31,32);
cout << result <<endl;
}

OUTPUT:`$V3.82``

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mathews lee