Text processing | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Text processing

Hi clas, plese describe to me what is differences about boost.regex match, strcmp, ordinary if clause? All is related to string validation works.

26th Feb 2021, 3:55 AM
Oliver Pasaribu
Oliver Pasaribu - avatar
6 Answers
0
Strcmp is used for string comparison, in which each character is compared with relative string in ASCII characters, its difference is shown as output if difference is 0 then string are equal
27th Feb 2021, 11:29 AM
Ankit Nainwal
Ankit Nainwal - avatar
0
strcmp just compare string regexp is widest, and could perform pattern matching (not just a == b but a in b)
27th Feb 2021, 11:32 AM
visph
visph - avatar
0
So basically the purpose is to manipulate string object or variable. So, bost.regex itself actually is a string function and combination of conditional if?
27th Feb 2021, 2:32 PM
Oliver Pasaribu
Oliver Pasaribu - avatar
0
I don't know bost.regex nor even regex in C/C++ are implemented... but I use regular expressions in other languages (a language inside another language) so I couldn't say if bost.regex is a string function ^^ however, yes, regular expression are designed to work with string, with a bit more than just few 'if' statements ;)
27th Feb 2021, 2:42 PM
visph
visph - avatar
0
So the purpose is just only simplification. This is similar with assert, or string replace, insert, erase, strcpy, strpbrk, find_first, etc? We do we need same functionality with many differents name? I am little bit confused except for cstring and string. But please tell me when we should use c++ string and when we should use cstring or c-style string?
27th Feb 2021, 2:51 PM
Oliver Pasaribu
Oliver Pasaribu - avatar
0
no reg exp are not just string "functionality with other names"... reg exp are powerfull kind of pattern language to do advanced search in string ^^ wich one of each should be used belong to you, depending on what you want/need to achieve: reg exp are powerfull but could be oversized to just check string equality ;)
27th Feb 2021, 2:55 PM
visph
visph - avatar