PureBytes Links
Trading Reference Links
|
--- In amibroker@xxxxxxxxxxxxxxx, "Conrad Joach" <consolejoker@xxx> wrote: > > I have strings that are delimited by multiple char types. For instance I have arrays within arrays like so: > > field1,field2,field3,field4|field1,field2,field3,field4 > > It would be nice if STREXTRACT would work like most modern versions of this type of string manipulation function and accept as an argument any arbitrary character.
I'm definitely not saying this is the best way to do this, but another option at your disposal is to enable script and use the split method of JScript:
EnableScript("JScript");
record = "1,2,3,14|15,6,7,28|29";
<%
var tempArr
= AFL.Var("record").split(',');
var splitArray =
new Array();
for ( var i = 0, len =
tempArr.length; i < len; i++ )
{
// If the array value contains a pipe
then re-split into a separate array
// otherwise add to the
"regular" array
if (tempArr[i].indexOf('|') != -1)
{
AFL("splitArray" + i) =
tempArr[i].split('|');
}
else
{
splitArray.push(tempArr[i]);
}
}
AFL("splitArray") = splitArray;
%>
// Plots
1,2,3,6,7
Plot(splitArray,"SplitArray", colorBlue,styleLine);
// Plots 14,15
Plot(VarGet("splitArray3"),"SplitArray3", colorGreen,styleLine);
// Plots 28,29
Plot(VarGet("splitArray6"),"SplitArray6", colorRed,styleLine);
Tuzo
__._,_.___
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
__,_._,___
|