Is there any function/procedure as ReplaceString but for whole words on Delphi? I just need to replace substring to the new one when it\'s a whole word. For example
You can use the built-in regex library to do this. For example:
{$APPTYPE CONSOLE}
uses
System.RegularExpressions;
const
InputString = 'a Substring, substring123, some more text';
begin
Writeln(TRegEx.Replace(InputString, '\bsubstring\b', 'newstring', [roIgnoreCase]));
end.