MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / main

Function main

applications/test/stringList/Test-stringList.C:37–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35// Main program:
36
37int main(int argc, char *argv[])
38{
39 stringList strLst
40 (
41 IStringStream
42 (
43 "("
44 "\"hello\""
45 "\"heello\""
46 "\"heeello\""
47 "\"bye\""
48 "\"bbye\""
49 "\"bbbye\""
50 "\"okey\""
51 "\"okkey\""
52 "\"okkkey\""
53 ")"
54 )()
55 );
56
57 wordReList reLst(IStringStream("( okey \"[hy]e+.*\" )")());
58
59 Info<< "stringList " << strLst << nl;
60
61 labelList matches = findStrings(".*ee.*", strLst);
62
63 Info<< "matches found for regexp .*ee.* :" << nl << matches << nl;
64 forAll(matches, i)
65 {
66 Info<< " -> " << strLst[matches[i]] << nl;
67 }
68 Info<< endl;
69
70 matches = findStrings(reLst, strLst);
71
72 Info<< "matches found for " << reLst << nl << matches << nl;
73 forAll(matches, i)
74 {
75 Info<< " -> " << strLst[matches[i]] << nl;
76 }
77 Info<< endl;
78
79 stringList subLst = subsetStrings(".*ee.*", strLst);
80 Info<< "subset stringList: " << subLst << nl;
81
82 subLst = subsetStrings(reLst, strLst);
83 Info<< "subset stringList: " << subLst << nl;
84
85 inplaceSubsetStrings(reLst, strLst);
86 Info<< "subsetted stringList: " << strLst << nl;
87
88 inplaceSubsetStrings(".*l.*", strLst);
89 Info<< "subsetted stringList: " << strLst << nl;
90
91 Info<< "\nEnd\n" << endl;
92
93 return 0;
94}

Callers

nothing calls this directly

Calls 4

findStringsFunction · 0.85
subsetStringsFunction · 0.85
inplaceSubsetStringsFunction · 0.85
forAllFunction · 0.50

Tested by

no test coverage detected