<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to get numbers from strings]]></title><description><![CDATA[<p dir="auto">I have a function that iterate over strings like</p>
<pre><code> strings = ["brass", "001", "127", "flute"]
</code></pre>
<p dir="auto">How can I find the string numbers from this array?<br />
I have tried "typeof", of course that's not going to work, eval(), etc....<br />
I even tried to let all strings pass</p>
<pre><code>Engine.getMidiNoteName(string)
</code></pre>
<p dir="auto">and it log "0" for all letter strings but it works for the "number" strings<br />
How do you do it?</p>
]]></description><link>https://forum.hise.audio/topic/14363/how-to-get-numbers-from-strings</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Apr 2026 01:27:17 GMT</lastBuildDate><atom:link href="https://forum.hise.audio/topic/14363.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 05 Feb 2026 10:12:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to get numbers from strings on Tue, 10 Feb 2026 05:31:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.hise.audio/uid/357">@dannytaurus</a> <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.hise.audio/uid/3118">@Oli-Ullmann</a> <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.hise.audio/uid/449">@ustk</a>  thank you all for the help, all your suggestions work great!</p>
]]></description><link>https://forum.hise.audio/post/117586</link><guid isPermaLink="true">https://forum.hise.audio/post/117586</guid><dc:creator><![CDATA[ulrik]]></dc:creator><pubDate>Tue, 10 Feb 2026 05:31:32 GMT</pubDate></item><item><title><![CDATA[Reply to How to get numbers from strings on Thu, 05 Feb 2026 12:07:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.hise.audio/uid/307">@ulrik</a> are you parsing dodgy data from somewhere?? Because grouping numbers and text strings like that into a single array seems like a poor design.</p>
]]></description><link>https://forum.hise.audio/post/117488</link><guid isPermaLink="true">https://forum.hise.audio/post/117488</guid><dc:creator><![CDATA[Orvillain]]></dc:creator><pubDate>Thu, 05 Feb 2026 12:07:59 GMT</pubDate></item><item><title><![CDATA[Reply to How to get numbers from strings on Thu, 05 Feb 2026 11:36:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.hise.audio/uid/307">@ulrik</a> said in <a href="/post/117472">How to get numbers from strings</a>:</p>
<blockquote>
<p dir="auto">How can I find the string numbers from this array?</p>
</blockquote>
<p dir="auto">How did the numbers get into the array as strings?</p>
]]></description><link>https://forum.hise.audio/post/117484</link><guid isPermaLink="true">https://forum.hise.audio/post/117484</guid><dc:creator><![CDATA[David Healey]]></dc:creator><pubDate>Thu, 05 Feb 2026 11:36:27 GMT</pubDate></item><item><title><![CDATA[Reply to How to get numbers from strings on Thu, 05 Feb 2026 11:23:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.hise.audio/uid/307">@ulrik</a> Or use regex to detect strings that only contains digits.</p>
<pre><code>const var strings = ["brass", "001", "127", "flute"];

for (s in strings)
{
  if (Engine.matchesRegex(s, "^\\d+$")) Console.print(parseInt(s));
}
</code></pre>
<p dir="auto"><code>^</code> means 'start of string'<br />
<code>\\d</code> means digit<br />
<code>+</code> means 'one or more'<br />
<code>$</code> means 'end of string`</p>
<p dir="auto">So, "one or more digits between the start and end of the string, and nothing else"</p>
]]></description><link>https://forum.hise.audio/post/117478</link><guid isPermaLink="true">https://forum.hise.audio/post/117478</guid><dc:creator><![CDATA[dannytaurus]]></dc:creator><pubDate>Thu, 05 Feb 2026 11:23:47 GMT</pubDate></item><item><title><![CDATA[Reply to How to get numbers from strings on Thu, 05 Feb 2026 11:09:13 GMT]]></title><description><![CDATA[<p dir="auto">Use <code>parseInt</code>. But you need to check the charcode of the first character to get rid of letter parsing returning <code>0</code></p>
<pre><code>const var strings = ["brass", "001", "127", "flute"];

for (s in strings)
{
	if (s.charCodeAt(0) &gt;= 48 &amp;&amp; s.charCodeAt(0) &lt;= 57) // &lt;= 0-9 numbers only
		Console.print(parseInt(s));
}
</code></pre>
<p dir="auto">As <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.hise.audio/uid/3118">@Oli-Ullmann</a> said <code>String.getIntValue()</code> also works, I don't know if there's any difference between the two...</p>
]]></description><link>https://forum.hise.audio/post/117475</link><guid isPermaLink="true">https://forum.hise.audio/post/117475</guid><dc:creator><![CDATA[ustk]]></dc:creator><pubDate>Thu, 05 Feb 2026 11:09:13 GMT</pubDate></item><item><title><![CDATA[Reply to How to get numbers from strings on Thu, 05 Feb 2026 10:22:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.hise.audio/uid/307">@ulrik</a><br />
I'm not sure I fully understand your question, but there is <code>String.getIntValue()</code>. This function converts a string into an integer.</p>
<p dir="auto">And there is <code>Engine.getValueForText(String text, String convertedMode)</code>.</p>
]]></description><link>https://forum.hise.audio/post/117473</link><guid isPermaLink="true">https://forum.hise.audio/post/117473</guid><dc:creator><![CDATA[Oli Ullmann]]></dc:creator><pubDate>Thu, 05 Feb 2026 10:22:07 GMT</pubDate></item></channel></rss>