MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / StringConv

Class StringConv

inst/tinytest/cpp/String.cpp:24–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22}
23
24class StringConv{
25public:
26 typedef String result_type ;
27 StringConv( CharacterVector old_, CharacterVector new__):
28 nr(old_.size()), old(old_), new_(new__){}
29
30 String operator()(String text) const {
31 for( int i=0; i<nr; i++){
32 text.replace_all( old[i], new_[i] ) ;
33 }
34 return text ;
35 }
36
37private:
38 int nr ;
39 CharacterVector old ;
40 CharacterVector new_ ;
41} ;
42
43// [[Rcpp::export]]
44CharacterVector test_sapply_string( CharacterVector text, CharacterVector old , CharacterVector new_){

Callers 1

test_sapply_stringFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_sapply_stringFunction · 0.68