<?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: Removing the end of a string of variable length in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Removing-the-end-of-a-string-of-variable-length/m-p/319942#M57035</link>
    <description>&lt;P&gt;I thought of using the Left() function, too. Here is my take:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );

string = "AAA-BB-1234-19-001";

Left( string, Contains( string, "00") - 2 );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I recommend that you select Help &amp;gt; Scripting Index and select Functions &amp;gt; Character. There is a lot of built-in support for manipulating character strings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 10 Oct 2020 13:18:27 GMT</pubDate>
    <dc:creator>Mark_Bailey</dc:creator>
    <dc:date>2020-10-10T13:18:27Z</dc:date>
    <item>
      <title>Removing the end of a string of variable length</title>
      <link>https://community.jmp.com/t5/Discussions/Removing-the-end-of-a-string-of-variable-length/m-p/319806#M57017</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a column :Protocol which contains strings of variable length in the format Character, Nominal. I've added some examples below. I am trying to remove the last 4 characters of the string from the column, and keep everything else. The last 4 characters are always one of: -001, -002, -003, or -004. I have tried to accomplish this using Word(), and Substr() but am unable to get it to work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;Protocol&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;AAA-BB-1234-19&lt;STRONG&gt;-001&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;AAAA-B-18&lt;STRONG&gt;-002&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;AA-BBB-123-18-&lt;STRONG&gt;003&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;AA-B-CC-1001-19-&lt;STRONG&gt;002&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I want the column to look like for those 4 rows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;Protocol&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;AAA-BB-1234-19&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;AAAA-B-18&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;AA-BBB-123-18&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;AA-B-CC-1001-19&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried to accomplish this using the Word() functions as follows:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For Each Row(
	:Protocol = Word(1, :Protocol, "00")
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2023 23:40:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Removing-the-end-of-a-string-of-variable-length/m-p/319806#M57017</guid>
      <dc:creator>DanAlexander</dc:creator>
      <dc:date>2023-06-09T23:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Removing the end of a string of variable length</title>
      <link>https://community.jmp.com/t5/Discussions/Removing-the-end-of-a-string-of-variable-length/m-p/319850#M57020</link>
      <description>Something like
Left(:Protocol, Length(:Protocol) - 4)</description>
      <pubDate>Fri, 09 Oct 2020 20:10:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Removing-the-end-of-a-string-of-variable-length/m-p/319850#M57020</guid>
      <dc:creator>David_Burnham</dc:creator>
      <dc:date>2020-10-09T20:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Removing the end of a string of variable length</title>
      <link>https://community.jmp.com/t5/Discussions/Removing-the-end-of-a-string-of-variable-length/m-p/319917#M57030</link>
      <description>&lt;P&gt;I agree with&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4536"&gt;@David_Burnham&lt;/a&gt;&amp;nbsp;, you can get results by directly using left, if you really wanna use word, maybe you can refer to this one below (I also attached data table in attachment):&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
Clear Log();
dt = Current Data Table();
new_col = dt &amp;lt;&amp;lt; New Column( "Trimmed Protocol",
	character,
	formula( Word( [1 -2], :Protocol, "-" ) )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Oct 2020 03:55:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Removing-the-end-of-a-string-of-variable-length/m-p/319917#M57030</guid>
      <dc:creator>JLX</dc:creator>
      <dc:date>2020-10-10T03:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: Removing the end of a string of variable length</title>
      <link>https://community.jmp.com/t5/Discussions/Removing-the-end-of-a-string-of-variable-length/m-p/319942#M57035</link>
      <description>&lt;P&gt;I thought of using the Left() function, too. Here is my take:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );

string = "AAA-BB-1234-19-001";

Left( string, Contains( string, "00") - 2 );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I recommend that you select Help &amp;gt; Scripting Index and select Functions &amp;gt; Character. There is a lot of built-in support for manipulating character strings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Oct 2020 13:18:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Removing-the-end-of-a-string-of-variable-length/m-p/319942#M57035</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2020-10-10T13:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: Removing the end of a string of variable length</title>
      <link>https://community.jmp.com/t5/Discussions/Removing-the-end-of-a-string-of-variable-length/m-p/320019#M57053</link>
      <description>Thank you, I tried your solution and it worked perfectly.</description>
      <pubDate>Sat, 10 Oct 2020 23:11:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Removing-the-end-of-a-string-of-variable-length/m-p/320019#M57053</guid>
      <dc:creator>DanAlexander</dc:creator>
      <dc:date>2020-10-10T23:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: Removing the end of a string of variable length</title>
      <link>https://community.jmp.com/t5/Discussions/Removing-the-end-of-a-string-of-variable-length/m-p/809351#M98927</link>
      <description>&lt;DIV&gt;// I had a similar problem with removing the file name from the file path&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Names Default To Here( 1 );&lt;/DIV&gt;&lt;DIV&gt;dt = Current Data Table();&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;current_file = dt &amp;lt;&amp;lt; Get Path();&lt;/DIV&gt;&lt;DIV&gt;current_directory = Word([1 -2], current_file, "\");&lt;/DIV&gt;&lt;DIV&gt;// return the full string ([1 -1]), except for the last word ([1 -2])&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;data = Pick File(&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"Select Data Files",&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;current_directory,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;{"Excel|csv","JMP Files|jmp;jsl;jrn","All Files|*"},&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;1,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;0,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"", multiple&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;);&lt;/DIV&gt;</description>
      <pubDate>Thu, 31 Oct 2024 14:04:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Removing-the-end-of-a-string-of-variable-length/m-p/809351#M98927</guid>
      <dc:creator>Crew</dc:creator>
      <dc:date>2024-10-31T14:04:25Z</dc:date>
    </item>
  </channel>
</rss>

