MCPcopy Create free account
hub / github.com/derceg/explorerplusplus / ReplaceCharacterWithString

Function ReplaceCharacterWithString

Explorer++/Helper/StringHelper.cpp:308–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306}
307
308void ReplaceCharacterWithString(const TCHAR *szBaseString, TCHAR *szOutput,
309 UINT cchMax, TCHAR chToReplace, const TCHAR *szReplacement)
310{
311 TCHAR szNewString[1024];
312 int iBase = 0;
313 int i = 0;
314
315 szNewString[0] = '\0';
316 for(i = 0; i < lstrlen(szBaseString); i++)
317 {
318 if(szBaseString[i] == chToReplace)
319 {
320 StringCchCatN(szNewString, SIZEOF_ARRAY(szNewString),
321 &szBaseString[iBase], i - iBase);
322 StringCchCat(szNewString, SIZEOF_ARRAY(szNewString), szReplacement);
323
324 iBase = i + 1;
325 }
326 }
327
328 StringCchCatN(szNewString, SIZEOF_ARRAY(szNewString),
329 &szBaseString[iBase], i - iBase);
330
331 StringCchCopy(szOutput, cchMax, szNewString);
332}
333
334void TrimStringLeft(std::wstring &str, const std::wstring &strWhitespace)
335{

Callers 1

TESTFunction · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68