<div dir="ltr"><div dir="ltr">Oops, I forgot to send a patch. ^^'</div><div dir="ltr"><br></div><div dir="ltr">Could you apply this one in attachment? The <font face="monospace" size="1">String.prototype.split()</font> (and many other string functions) allows to pass as <i>separator</i>(*) the most powerful feature also presente in JS: regular expressions. After applying the patch, it allows:</div><div dir="ltr"><font face="monospace" size="1"><br></font></div><div dir="ltr"><font face="monospace" size="1">uses JS, Web;<br><br>var<br>  S: string;<br>  A: TStringDynArray;<br>begin<br>  S := 's:foo.bar';<br>  A := TJSString(S).split(TJSRegexp.New('[:.]'));<br>  console.log(A);<br>end.</font><br></div><div><br></div><div>Result:</div><div><br></div><div><font face="monospace" size="1">(3) ["s", "foo", "bar"]</font><br></div><div><br></div><div>The equivalent version in pure JS (notice the regex part as parameter):</div><div><br></div><div><font face="monospace" size="1">var s = 's:foo.bar';<br>var a = s.split(/[:\.]/);<br>console.log(a);</font><br></div><div><br></div><div><div>Result:</div><div><br></div><div><font face="monospace" size="1">(3) ["s", "foo", "bar"]</font></div></div><div><br></div><div>Thank you again!</div><div><br></div><div>(*) Snip from <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split">MDN</a>:</div><div><br></div><div><div><i><b>"... Separator</b></i><br></div><div><i>Specifies the string which denotes the points at which each split should occur. The separator is treated as a string <b><u>or as a regular expression</u></b>."</i></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Oct 7, 2019 at 10:29 AM silvioprog <<a href="mailto:silvioprog@gmail.com">silvioprog@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Fri, Oct 4, 2019 at 6:33 PM Michael Van Canneyt <<a href="mailto:michael@freepascal.org" target="_blank">michael@freepascal.org</a>> wrote:</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Hm. <br>
The documentation text does not mention the possibility of an array, so I<br>
didn't add that. I have added an overload.<br>
<br>
Michael.</blockquote></div><div><br></div><div>Indeed, sometimes the MDN web docs lacks information on top and are present only on bottom (examples area).</div><div><br></div><div>Thank you for solving! (y)</div><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div>Silvio Clécio</div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Silvio Clécio</div></div></div></div>