{"id":737,"date":"2010-10-21T08:33:42","date_gmt":"2010-10-21T15:33:42","guid":{"rendered":"http:\/\/45.63.48.66\/?p=737"},"modified":"2019-05-02T14:52:00","modified_gmt":"2019-05-02T21:52:00","slug":"advanced-string-replace-function","status":"publish","type":"post","link":"https:\/\/gotcal.com\/index.php\/2010\/10\/advanced-string-replace-function\/","title":{"rendered":"Advanced String Replace Function"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-738\" title=\"stringfunctions\" src=\"\/wp-content\/uploads\/2010\/10\/stringfunctions.jpg\" alt=\"\" width=\"247\" height=\"156\">Using the built-in string functions in Dynamics NAV usually gives you all the string manipulation options you need. But a common request is replacing a special char with a new string value. This example came from the previous post on <a href=\"http:\/\/45.63.48.66\/index.php\/2010\/06\/smtp-mail-functionality-in-pre-dynamics-nav-5-version\/\">SMTP Mail functionality in Pre Dynamics NAV 5 versions<\/a>. Mads from Denmark, ran into an issue with HTML encoding when using national chars like: \u00e6\u00f8\u00e5\u00c6\u00d8\u00c5. For some reason the HTML emails worked fine at my local computer, here with US locale settings, but changing the values to their HTML encoded equivalent might be a good idea to get better compatability.<\/p>\n<p>Below you will find the simple function for doing this.<\/p>\n<p><!--more--><\/p>\n<p>Here is a simple example of how to HTML encode my name:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nt := 'S\u00f8ren';\nmessage(t);\nInsertVariableValue(t,'\u00f8','&amp;amp;oslash;');\nmessage(t);\n\nInsertVariableValue(VAR Formula : Text&#x5B;30];VariableName : Text&#x5B;30];VariableValue : Text&#x5B;30])\nWHILE STRPOS(Formula,VariableName) &amp;lt;&amp;gt; 0 DO BEGIN\nPos := STRPOS(Formula,VariableName);\nFormula := DELSTR(Formula,Pos,STRLEN(VariableName));\nFormula := INSSTR(Formula,DELCHR(FORMAT(VariableValue),'=',','),Pos);\nEND;<\/pre>\n<p>This function was previously discussed in this post: <a href=\"http:\/\/45.63.48.66\/index.php\/2010\/06\/evaluate-formulas-in-dynamics-nav-2\/\">Evaluate Formulas in Dynamics NAV<\/a> and also on numerous posts on <a href=\"http:\/\/mibuso.com\">Mibuso<\/a> and <a href=\"http:\/\/dynamicsuser.net\">DynamicsUser<\/a>. Hope you can use this Mads, and also you other readers :).<\/p>\n<p>Here is a link for you Mads \ud83d\ude42 :<br \/>\n<a href=\"http:\/\/www.yougotbeer.com\/ygb\/buy-me-a-beer.jsp?id=5996675\" target=\"_blank\" title=\"Buy Soren a Beer at YouGotBeer.com\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"http:\/\/www.yougotbeer.com\/linkImages\/5_24_buy-me-a-beer.gif\" style=\"border: solid black 2px\"><\/a><\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Using the built-in string functions in Dynamics NAV usually gives you all the string manipulation options you need. But a common request is replacing a special char with a new string value. This example came from the previous post on SMTP Mail functionality in Pre Dynamics NAV 5 versions. Mads from Denmark, ran into an [&hellip;]<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[56,3],"tags":[27,55,7,39,41],"class_list":["post-737","post","type-post","status-publish","format-standard","hentry","category-basic-cal","category-navision","tag-how-to","tag-html","tag-objects","tag-programming","tag-tools"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts\/737","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/comments?post=737"}],"version-history":[{"count":16,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts\/737\/revisions"}],"predecessor-version":[{"id":1023,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts\/737\/revisions\/1023"}],"wp:attachment":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/media?parent=737"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/categories?post=737"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/tags?post=737"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}