Title: Boost Library Introduction: String Processing

zhaozj2021-02-16  54

Text: 3 Regular Expression 3.1 Related Clices: Basic_Regex Regex 3.2 Definition File #include 3.3 Function Introduction to establish a certain rule of Regex expression class object, will test if existing substrings are with regex objects Whether it matches, use member function Match to test. 3.4 Example 3.5 Other regex is used to handle regular expressions. Symbol sequence into container 4 Class 4.1 tokenizer token_iterator TokenizerFunc function template: char_separator escaped_list_separator offset_separator 4.2 definition file #include 4.3 Introduction to break down a string is a sequence of symbols or other substrings using a specific Separation method. The default separation method is separated from a space to separate a string. 4.4 Using the example UltraEdit10.10C MS C / C Compiler12.00.8804 for 80x86 win2k (sp5) boost131 test passed. // Sample code is taken from the Boost library document. // simple_example_1.cpp #include #include #include

INT main () {using namespace std; use namespace boost; string s = "this is, a test"; tokenizer <> tok (s); for (tokenizer <> :: iterator beg = tok.begin (); becom! = tok.end (); beg) {cout << * beg << "/ n";}}

// simple_example_2.cpp #include #include #include

INT main () {Using Namespace std; use namespace boost; string s = "field 1, /" putting quotes around fields, allows commas / ", field 3"; tokenizer > tok (s); for Tokenizer > :: itrator beg = tok.begin (); beg! = tok.end (); becom {cout << * beg << "/ n";}}

// simple_example_3.cpp #include #include #include

INT main () {using namespace std; sales s = "12252001"; int offsets [] = {2, 2, 4}; offset_separator f (Offsets, Offsets 3); tokenizer Tok (S , f); for (tokenizer :: item beg = tok.begin (); beg! = tok.end (); becom {cout << * beg << "/ n";}} : About string processing, there is a spirit, I think spirit use file resolution container, I have not seen it very clear, so there is related use or use of the Chinese document, please send one: myemail_cn@tom.com is not finished, stay Continued.

转载请注明原文地址:https://www.9cbs.com/read-22281.html

New Post(0)