Skip to Content
author's profile photo Former Member
Former Member

Unable to print elements of an array

local stringvar mystr := "UPDATE: A=5; oldA= 3,B=2; oldB= 3,C=4; oldC= 3";

local stringvar mystr1;

local stringvar output="";

If (mystr[1 to 6] like "UPDATE") then (

mystr1 := MID(mystr, INSTR(mystr, ":") + 2) ;

stringvar array allChanges := Split(mystr1,",");//this puts each line into individual array slots

Local NumberVar numOfChanges:=Ubound(allChanges);

Local NumberVar i:= 1 ;

Redim allChanges[numOfChanges];

While i <= numOfChanges Do

(

join(allChanges,',');

i := i + 1;

);

)

Above Function prints True.

I was expecting it to print :

A=5; oldA= 3

B=2; oldB= 3

C=4; oldC= 3

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Feb 16, 2016 at 08:01 AM

    Hi Shradha,

    This code should work:

    local stringvar mystr := "UPDATE: A=5; oldA= 3,B=2; oldB= 3,C=4; oldC= 3";

    If Left(mystr,6) = 'UPDATE' then

    (

    local stringvar array arr := split(MID(mystr, INSTR(mystr, ":") + 2), ',');

    local stringvar fin := Join(arr, chr(13));

    );

    fin;

    -Abhilash

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.