Home
|
Develop
|
Download
|
Contact
test
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
43
id
=
Pds::Ra::FnMatch
(pat, str,
Pds::Ra::FNM_CASEFOLD
);
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
52
id
=
Pds::Ra::FnMatch
(pat, str,
Pds::Ra::FNM_CASEFOLD
);
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
61
id
=
Pds::Ra::FnMatch
(pat, str,
Pds::Ra::FNM_CASEFOLD
);
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
70
id
=
Pds::Ra::FnMatch
(pat, str,
Pds::Ra::FNM_CASEFOLD
);
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
79
id
=
Pds::Ra::FnMatch
(pat, str,
Pds::Ra::FNM_CASEFOLD
);
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
88
id
=
Pds::Ra::FnMatch
(pat, str,
Pds::Ra::FNM_CASEFOLD
);
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
Pds::Ra::FnMatch
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....
Pds::Ra::FNM_CASEFOLD
const unsigned int FNM_CASEFOLD
Definition:
RaMatch.hpp:101
Enlaces de interés
Manual de referencia generado el Domingo, 28 de Noviembre de 2021 01:26:40 para la biblioteca
libpdsramm
usando Generado el Domingo, 28 de Noviembre de 2021 01:26:40 para libpdsramm por
1.9.2