<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Substitute characters in strings with new lines and tabs in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Substitute-characters-in-strings-with-new-lines-and-tabs/m-p/350754#M60030</link>
    <description>&lt;P&gt;You can use &lt;A href="https://www.jmp.com/support/help/en/15.2/index.shtml#page/jmp/jsl-syntax-rules.shtml#ww987811" target="_self"&gt;escape sequences&lt;/A&gt; for those special characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;SQL_query =
"SELECT a, b, c
	FROM mytable
	WHERE a = 'alice'
		AND b BETWEEN '86' AND '91'";

SQL_query = Substitute( SQL_query,
	"\!t", " ",
	"\!r", " "
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You might also find the &lt;A href="https://www.jmp.com/support/help/en/15.2/index.shtml#page/jmp/list-functions.shtml#ww2490274" target="_self"&gt;Substitute Into()&lt;/A&gt; function useful. It will do the substitution in place and avoid the assignment back to the original string.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Substitute Into( SQL_query,
	"\!t", " ",
	"\!r", " "
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Jan 2021 19:56:14 GMT</pubDate>
    <dc:creator>Jeff_Perkinson</dc:creator>
    <dc:date>2021-01-18T19:56:14Z</dc:date>
    <item>
      <title>Substitute characters in strings with new lines and tabs</title>
      <link>https://community.jmp.com/t5/Discussions/Substitute-characters-in-strings-with-new-lines-and-tabs/m-p/350702#M60022</link>
      <description>&lt;P&gt;I am writing a OLEDB query that needs the SQL command to be in a string without containing end of lines or tabs, only spaces.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following works, but I cannot find how to do this without having to create the 'empty' strings.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;User may modify the SQL query, using JMP installed in Windows machines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;SQL_query = "SELECT a, b, c
	FROM mytable
	WHERE a = 'alice'
		AND b BETWEEN '86' AND '91'";

// Cleansing strings (inputs need to be in one line)
newline = "
";
tab = "	";
space = " ";

SQL_query = substitute(SQL_query, tab, space);
SQL_query = substitute(SQL_query, newline, space);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 22:03:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Substitute-characters-in-strings-with-new-lines-and-tabs/m-p/350702#M60022</guid>
      <dc:creator>FN</dc:creator>
      <dc:date>2023-06-09T22:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: Substitute characters in strings with new lines and tabs</title>
      <link>https://community.jmp.com/t5/Discussions/Substitute-characters-in-strings-with-new-lines-and-tabs/m-p/350754#M60030</link>
      <description>&lt;P&gt;You can use &lt;A href="https://www.jmp.com/support/help/en/15.2/index.shtml#page/jmp/jsl-syntax-rules.shtml#ww987811" target="_self"&gt;escape sequences&lt;/A&gt; for those special characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;SQL_query =
"SELECT a, b, c
	FROM mytable
	WHERE a = 'alice'
		AND b BETWEEN '86' AND '91'";

SQL_query = Substitute( SQL_query,
	"\!t", " ",
	"\!r", " "
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You might also find the &lt;A href="https://www.jmp.com/support/help/en/15.2/index.shtml#page/jmp/list-functions.shtml#ww2490274" target="_self"&gt;Substitute Into()&lt;/A&gt; function useful. It will do the substitution in place and avoid the assignment back to the original string.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Substitute Into( SQL_query,
	"\!t", " ",
	"\!r", " "
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 19:56:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Substitute-characters-in-strings-with-new-lines-and-tabs/m-p/350754#M60030</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2021-01-18T19:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: Substitute characters in strings with new lines and tabs</title>
      <link>https://community.jmp.com/t5/Discussions/Substitute-characters-in-strings-with-new-lines-and-tabs/m-p/350877#M60048</link>
      <description>&lt;P&gt;For some reason, none of these substitutions seem to work when inside an add-in I am developing (?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I copy and paste the code, the substitution works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2021 18:14:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Substitute-characters-in-strings-with-new-lines-and-tabs/m-p/350877#M60048</guid>
      <dc:creator>FN</dc:creator>
      <dc:date>2021-01-19T18:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: Substitute characters in strings with new lines and tabs</title>
      <link>https://community.jmp.com/t5/Discussions/Substitute-characters-in-strings-with-new-lines-and-tabs/m-p/350880#M60049</link>
      <description>&lt;P&gt;That's odd. There's nothing special about an add-in that would affect this. Can you provide any more detail about what exactly isn't working?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Hex() function may help you see exactly what (invisible) characters are in your input string.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;tab = "\!t";

Show( Hex( tab ) );

return = "\!r";

Show( Hex( return ) );

SQL_query =
"\[SELECT a, b, c
	FROM mytable
	WHERE a = 'alice'
		AND b BETWEEN '86' AND '91']\";
		
Show( Hex( SQL_query ) );

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;Hex(tab) = "09";
Hex(return) = "0D";
Hex(SQL_query) = "53454C45435420612C20622C20630D0946524F4D206D797461626C650D0957484552452061203D2027616C696365270D0909414E442062204245545745454E202738362720414E442027393127";
&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Jan 2021 19:13:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Substitute-characters-in-strings-with-new-lines-and-tabs/m-p/350880#M60049</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2021-01-19T19:13:55Z</dc:date>
    </item>
  </channel>
</rss>

