Patraca0423

string variables

5 posts in this topic

regards

how can i declare a string variable on sysmac? can you bring me an example?

ex.

var _a = type array[0..2] of string[20]

how can i put this string "hello world" on var_a[x]? 

var_a[x]:="hello world"

that is correct?

thanks

 

Share this post


Link to post
Share on other sites

Name                        Data Type                                                 Initial Value

var_a         ARRAY[0..2] OF STRING[20]         ['hello world 1', 'hello world 2', 'hello world 3'] 
 

If you input STRING[20][3] in the Data Type field it will convert it automatically to look like the above. You don't have to populate the Initial Value field. You can write to it at runtime.

Share this post


Link to post
Share on other sites

thanks io_rack

so can i to put this in my code?

ex.

Name                        Data Type                                                                                                                                                                                  Initial Value

var_a                      STRING[20][3]  = 4 strings of 20 right? or =( STRING[20][1],STRING[20][2],STRING[20][3]

var_a[0]:='hello'               //this is correct? the value asigned to my first string of 20 its equal to 'hello'?

var_a[1]:='world'            //var_a[1] contains the string 'world'?

regardas

Share this post


Link to post
Share on other sites

Yes, I believe that is correct.

Have you tried it in the simulator?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now