Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checking the format of a string

Tags:

c++

std

I have a vector of strings im working trought, and i need to check how the string is formated. Im using sscanf in the rest of the function and i need something like this.

if (format("%f,%f,%f")) {
  // Do someting
} else if (format("%d,%d")) {
  // Do something else
} else {
  // Do something
}

Is this possible using sscanf or something else from std?

like image 826
user978281 Avatar asked May 17 '26 16:05

user978281


1 Answers

If you are able to use tr1 then std::tr1::regex is the way to go.. take a look here.

like image 185
Jack Avatar answered May 20 '26 06:05

Jack



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!