ReplaceAllAcc
Function Usage
Performs string match and Replace All operations according to the fixed regular expression rule "[^A-Za-z0-9_/.]+" based on the shufti algorithm.
Function Syntax
std::string ReplaceAllAcc(const std::string& input, const std::string& replacement)
Parameters
Parameter |
Description |
Value Range |
Input/Output |
|---|---|---|---|
input |
Input string (string to be replaced) |
C++ string object, which can be null. |
Input |
replacement |
Replacement string |
C++ string object, which can be null. |
Input |
Return Value
String after the Replace All operation is performed.
The input string is not modified.
Example
- Create a testReplaceAll.cpp file.
- Press i to enter the insert mode and add the following content to the file:
#include "khsel_ops.h" #include <iostream> int main() { std::string input = "Hello*#$&@Hello12345!()"; std::string replacement = "hi"; std::cout << ReplaceAllAcc(input, replacement) << std::endl; return 0; } - Press Esc, type :wq!, and press Enter to save the file and exit.
- Compile the testReplaceAll.cpp file and specify the name of the output executable file as testReplaceAll.
g++ testReplaceAll.cpp -o testReplaceAll -I /usr/local/ksl/include -L /usr/local/ksl/lib -lKHSEL_ops
- Run the testReplaceAll executable file.
./testReplaceAll
The execution result is as follows:HellohiHello12345hi
Parent topic: Function Syntax