Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

String Creation

tstevic
2019-04-05
2019-04-08
  • tstevic - 2019-04-05

    I have several strings I would like to combine.
    STRING1
    STRING2
    STRING3
    STRING_RESULT

    Effectively, I want to do:

    STRING_RESULT := CONCAT(STRING1, STRING2);
    STRING_RESULT := CONCAT(STRING_RESULT, STRING3);

    The message I want to build has 14 separate variable values and 3 constant values that need to be combined.
    I have look through the standard libraries and could not find any function that I think will work. Any suggestions?

     
  • johnlee - 2019-04-06

    StrResult : string;
    str : array[0..14] of string;
    i : int ;

    StrResult := '';

    For i := 0 to 14 do
    StrResult := concat(StrResult,str [i]);

    End_for

     
  • tstevic - 2019-04-08

    Excellent Idea. Thank You.

     

Log in to post a comment.