How to I read in a text file ignoring the digits, just want the text in the text file
Any sample code?
Or you could read one line at a time (or even the whole file) and use standard algorithms to remove digits:
#include <algorithm> // remove_if()
#include <cctype> // isdigit()
#include <functional> // ptr_fun<>
#include <string>
...
string remove_digits( const string& s )
{
string result( s );
result.erase(
remove_if(
result.begin(),
result.end(),
ptr_fun<int,int>( isdigit )
),
result.end()
);
return result;
}
Enjoy.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.