Squashed feature branch:
* Added CUDA support * Performance improvements * API improvements * Added "depth" parameter to GEMM * Android cross-compilation
This commit is contained in:
27
include/isaac/tools/find_and_replace.hpp
Normal file
27
include/isaac/tools/find_and_replace.hpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef ISAAC_TOOLS_FIND_AND_REPLACE_HPP
|
||||
#define ISAAC_TOOLS_FIND_AND_REPLACE_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace isaac
|
||||
{
|
||||
namespace tools
|
||||
{
|
||||
|
||||
int inline find_and_replace(std::string & source, std::string const & find, std::string const & replace)
|
||||
{
|
||||
int num=0;
|
||||
size_t fLen = find.size();
|
||||
size_t rLen = replace.size();
|
||||
for (size_t pos=0; (pos=source.find(find, pos))!=std::string::npos; pos+=rLen)
|
||||
{
|
||||
num++;
|
||||
source.replace(pos, fLen, replace);
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user