Home | Develop | Download | Contact
example_ra_match.cpp
1 
30 #include <Pds/Ra>
31 
32 int main(void)
33 {
34  int id;
35  std::string str;
36  std::string pat;
37 
38  // Test1
39  std::cout<<std::endl;
40  str="abcdef";
41  pat="a*f";
42 
44  if(id==0) std::cout<<" Found \""<<pat<<"\" in : \""<<str<<"\"\n";
45  else std::cout<<"Not found \""<<pat<<"\" in : \""<<str<<"\"\n";
46 
47  // Test2
48  std::cout<<std::endl;
49  str="abcdee";
50  pat="a*f";
51 
53  if(id==0) std::cout<<" Found \""<<pat<<"\" in : \""<<str<<"\"\n";
54  else std::cout<<"Not found \""<<pat<<"\" in : \""<<str<<"\"\n";
55 
56  // Test3
57  std::cout<<std::endl;
58  str="qxx";
59  pat="[a-z]xx";
60 
62  if(id==0) std::cout<<" Found \""<<pat<<"\" in : \""<<str<<"\"\n";
63  else std::cout<<"Not found \""<<pat<<"\" in : \""<<str<<"\"\n";
64 
65  // Test4
66  std::cout<<std::endl;
67  str="dqxx";
68  pat="[a-z]xx";
69 
71  if(id==0) std::cout<<" Found \""<<pat<<"\" in : \""<<str<<"\"\n";
72  else std::cout<<"Not found \""<<pat<<"\" in : \""<<str<<"\"\n";
73 
74  // Test5
75  std::cout<<std::endl;
76  str="abc";
77  pat="a??";
78 
80  if(id==0) std::cout<<" Found \""<<pat<<"\" in : \""<<str<<"\"\n";
81  else std::cout<<"Not found \""<<pat<<"\" in : \""<<str<<"\"\n";
82 
83  // Test6
84  std::cout<<std::endl;
85  str= "abcd";
86  pat="a??";
87 
89  if(id==0) std::cout<<" Found \""<<pat<<"\" in : \""<<str<<"\"\n";
90  else std::cout<<"Not found \""<<pat<<"\" in : \""<<str<<"\"\n";
91 
92 
93  return 0;
94 }
95 
int FnMatch(const std::string &pattern, const std::string &string, int flags)
función similar a fnmatch(), creada para tener compatibilidad en MinGw (code From FreeBSD fnmatch....
const unsigned int FNM_CASEFOLD
Definition: RaMatch.hpp:101

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed