| 306 | } |
| 307 | |
| 308 | void 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 | |
| 334 | void TrimStringLeft(std::wstring &str, const std::wstring &strWhitespace) |
| 335 | { |