MCPcopy Create free account
hub / github.com/docling-project/docling-parse / replace

Function replace

src/parse/utils/string.h:181–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179 }
180
181 std::string replace(std::string& text, const std::string& word_0, const std::string& word_1)
182 {
183 if(word_0==word_1)
184 {
185 return text;
186 }
187
188 std::size_t pos=0;
189 while(pos<text.size())
190 {
191 pos = text.find(word_0, pos);
192 if(pos==std::string::npos)
193 {
194 break;
195 }
196
197 text.replace(pos, word_0.size(), word_1);
198 pos += word_1.size();
199 }
200
201 return text;
202 }
203
204 bool is_space(char32_t c)
205 {

Callers 1

sanitize_textMethod · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected