{"id":217,"date":"2007-05-12T17:09:37","date_gmt":"2007-05-12T15:09:37","guid":{"rendered":" http:\/\/www.nsonic.de\/blog\/2007\/05\/how-to-use-stringreplace\/"},"modified":"2007-05-12T17:09:39","modified_gmt":"2007-05-12T15:09:39","slug":"how-to-use-stringreplace","status":"publish","type":"post","link":"https:\/\/www.nsonic.de\/blog\/2007\/05\/how-to-use-stringreplace\/","title":{"rendered":"How to use &#8220;stringreplace&#8221;"},"content":{"rendered":"<p><em>>could you tell me how to use &#8220;stringreplace&#8221;<br \/>\n>and if you don&#8217;t mind please send me a sample code<br \/>\n<\/em><\/p>\n<p>Are you having a specific problem with StringReplace?<\/p>\n<p>From the help:<br \/>\n>>>><br \/>\n  TReplaceFlags = set of (rfReplaceAll, rfIgnoreCase);<br \/>\nfunction StringReplace(const S, OldPattern, NewPattern: string; Flags:<br \/>\nTReplaceFlags): string;<br \/>\n<<<<\n\nExamples:\n<!--more--><br \/>\n[code lang=&#8221;delphi&#8221;]var s: string;<br \/>\nbegin<br \/>\n    s := Memo1.Text;<\/p>\n<p>    \/\/ replace just the first occurrence of &#8216;old&#8217; with &#8216;new&#8217;<br \/>\n    StringReplace(s, &#8216;old&#8217;, &#8216;new&#8217;, []);<br \/>\n    \/\/ replace ALL occurrences of &#8216;old&#8217; with &#8216;new&#8217;<br \/>\n    StringReplace(s, &#8216;old&#8217;, &#8216;new&#8217;, [rfReplaceAll]);<br \/>\n    \/\/ replace just the first occurrence of &#8216;old&#8217; with &#8216;new&#8217; ignore<br \/>\ncharacter case<br \/>\n    StringReplace(s, &#8216;old&#8217;, &#8216;new&#8217;, [rfIgnoreCase]);<br \/>\n    \/\/  &#8230; all occurrences and ignore character case<br \/>\n    StringReplace(s, &#8216;old&#8217;, &#8216;new&#8217;, [rfReplaceAll, rfIgnoreCase]);<\/p>\n<p>    Memo1.Text := s;<br \/>\nend;<br \/>\n[\/code]<\/p>\n<p>[tags]Delphi, Strings[\/tags]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>>could you tell me how to use &#8220;stringreplace&#8221; >and if you don&#8217;t mind please send me a sample code Are you having a&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[11],"tags":[75,123],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p71Tml-3v","_links":{"self":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/217"}],"collection":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/comments?post=217"}],"version-history":[{"count":0,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/217\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/media?parent=217"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/categories?post=217"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/tags?post=217"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}