Customer Portal

use of string and array

Comments 2

  • Avatar
    dpavlis
    0
    Comment actions Permalink
    String can not be directly converted to bytes (array of bytes). One of the reasons is that string consists of chars, which are 16bit (unicode).

    You may access any character of string using charAt() function. You can also construct an array of strings (even one character strings) and then
    work with individual chars.

    string graphvariable;
    string[] arrayvariable;
    int a;
    //copy graphvariable to arrayvariable char by char
    for (a = 0; a < length(graphvariable); a++){
    append(arrayvariable, charAt(graphvariable,a);
    }
    //also following works
    arrayvariable[5]="X";


    See Container library for more details about arrays/lists in CTL.
  • Avatar
    admin
    0
    Comment actions Permalink
    Hi dmatusow,

    There are functions byte2str and str2byte, but those uses encoding as parameter so they may perform conversion.

    See http://doc.cloveretl.com/documentation/ ... -ctl2.html for details.

Please sign in to leave a comment.