c++ - Driver's license magnetic strip data format -


from wikipedia article(http://en.wikipedia.org/wiki/magnetic_stripe_card#cite_note-14), understand basic data format driver's license. starts location data looks this: %codenver^

i wondering if city consists of 2 or more words new york city?

what data output like, , white-space character separates words, or it's else?

how write c++ statement return each word in city name in different strings?

it depend on delimiter. states use different formats data. mag stripes have 1 delimiter split data different sections, delimiter split sections individual parts.

for example, let's data want parse is:

new^york^city 

use split out:

int main() {     std::string s = "new^york^city";     std::string delim = "^";      auto start = 0u;     auto end = s.find(delim);     while (end != std::string::npos)     {         std::cout << s.substr(start, end - start) << std::endl;         start = end + delim.length();         end = s.find(delim, start);     }      std::cout << s.substr(start, end); } 

then output should be:

new york city 

search more c++ string parsing. used split function here: parse (split) string in c++ using string delimiter (standard c++)


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -