<?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: User-created array in GDL</title>
    <link>https://community.graphisoft.com/t5/GDL/User-created-array/m-p/604152#M6633</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://gdl.graphisoft.com/reference-guide/functions#SPLIT_gdlcommand" target="_blank" rel="noopener"&gt;SPLIT&lt;/A&gt; is the command that converts strings to numbers. You can make an assumption about the maximum number of numbers present in the infield, or pre-split the whole string with scottjm's code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV style="color: #3d3d3d; background-color: #fafafa; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 12px; line-height: 16px; white-space: pre;"&gt;
&lt;DIV&gt;&lt;SPAN&gt;dim&lt;/SPAN&gt;&lt;SPAN&gt; numbers&lt;/SPAN&gt;&lt;SPAN&gt;[]&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;n &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;split&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"1/2"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt; &lt;SPAN&gt;"%n/%n/%n"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt; &lt;SPAN&gt;numbers)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;print&lt;/SPAN&gt;&lt;SPAN&gt; n&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt; numbers[1], numbers[3]&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
    <pubDate>Fri, 17 May 2024 07:31:07 GMT</pubDate>
    <dc:creator>Peter Baksa</dc:creator>
    <dc:date>2024-05-17T07:31:07Z</dc:date>
    <item>
      <title>User-created array</title>
      <link>https://community.graphisoft.com/t5/GDL/User-created-array/m-p/603806#M6625</link>
      <description>&lt;P&gt;Hello everyone,&lt;BR /&gt;I've been studying arrays, and I'd like to know if an idea I had in mind was possible:&lt;/P&gt;
&lt;P&gt;I'd like to give the user the possibility of manually entering numbers in an ui_infield by separating them with a space (or a /) and have these numbers automatically transferred into an array, one entry per number.&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;P&gt;0 1 12 15 16 30&lt;BR /&gt;or&lt;BR /&gt;0/1/12/15/16/30&lt;/P&gt;
&lt;P&gt;I've looked at STRSUB, but you need to know the length of the elements. The problem with numbers is that they can be 1, 2 or 3+ long.&lt;/P&gt;
&lt;P&gt;Any ideas on how to extract the data from the text?&lt;BR /&gt;(And how to enter them in an array?)&lt;/P&gt;
&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 08:47:39 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/User-created-array/m-p/603806#M6625</guid>
      <dc:creator>Mathias Jonathan</dc:creator>
      <dc:date>2024-05-15T08:47:39Z</dc:date>
    </item>
    <item>
      <title>Re: User-created array</title>
      <link>https://community.graphisoft.com/t5/GDL/User-created-array/m-p/603848#M6627</link>
      <description>&lt;P&gt;STRSTR will return the location of a character in a string. So can be used in conjunction with STRSUB to split strings at certain characters.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;I’m thinking you’d want a while loop to process the input string, split it at the slash and grab the first part and drop it into the first index of an array.&amp;nbsp;&lt;BR /&gt;Then grab the remainder of the string and do the same thing again. And keep doing that until you can’t find any more slashes in your string.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;I’m not at a computer at the moment so this probably has syntax errors galore but maybe something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Input_str = “0/1/12/15/16/30”
slash_present = true
dim inputs_array[]
i = 1

WHILE slash_present DO
     slash_pos = STRSTR(input_str, “/“)
     IF slash_pos &amp;lt;&amp;gt; 0 THEN
           inputs_ary[i] = SUBSTR(input_str,1,slash_pos)
           Input_str = SUBSTR(input_str,slash_pos+1,STRLEN(input_str))
          i = i + 1
     ELSE
         slash_present = false
     ENDIF
ENDWHILE
&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 16 May 2024 11:41:42 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/User-created-array/m-p/603848#M6627</guid>
      <dc:creator>scottjm</dc:creator>
      <dc:date>2024-05-16T11:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: User-created array</title>
      <link>https://community.graphisoft.com/t5/GDL/User-created-array/m-p/604152#M6633</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://gdl.graphisoft.com/reference-guide/functions#SPLIT_gdlcommand" target="_blank" rel="noopener"&gt;SPLIT&lt;/A&gt; is the command that converts strings to numbers. You can make an assumption about the maximum number of numbers present in the infield, or pre-split the whole string with scottjm's code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV style="color: #3d3d3d; background-color: #fafafa; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 12px; line-height: 16px; white-space: pre;"&gt;
&lt;DIV&gt;&lt;SPAN&gt;dim&lt;/SPAN&gt;&lt;SPAN&gt; numbers&lt;/SPAN&gt;&lt;SPAN&gt;[]&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;n &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;split&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"1/2"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt; &lt;SPAN&gt;"%n/%n/%n"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt; &lt;SPAN&gt;numbers)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;print&lt;/SPAN&gt;&lt;SPAN&gt; n&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt; numbers[1], numbers[3]&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 17 May 2024 07:31:07 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/User-created-array/m-p/604152#M6633</guid>
      <dc:creator>Peter Baksa</dc:creator>
      <dc:date>2024-05-17T07:31:07Z</dc:date>
    </item>
  </channel>
</rss>

