converting an array to a string...

Is there an easy way to convert an array to a string? I am wanting to convert and array like {"This", "is", "an", "array"} to "This is an array". This would be similar to the str() or val() or recordtostring() functions but would work on an array.

I am sure it can be done with a a loop and a few strrep() statements but if there is a simplier way...
Parents
  • I don't know of a simplier way in SC system language, but if you can use javascript you may be able to use the .join method on the array. The syntax is:
    outputStr = inputArray.join( delimiter );

    If you wrote a little javascript function you could use it in SC expressions.
    function ats( scArray, scDelim )
    {
    var newstuff = scArray.join( scDelim );
    return newstuff;
    }

    Call the js function in an expression like this:
    $L.newstr=jscall("test.ats",$L.array," ")

    "test" in "test.ats" would be the name of the ScriptLibrary record.

    Good luck!
    Sam
Reply
  • I don't know of a simplier way in SC system language, but if you can use javascript you may be able to use the .join method on the array. The syntax is:
    outputStr = inputArray.join( delimiter );

    If you wrote a little javascript function you could use it in SC expressions.
    function ats( scArray, scDelim )
    {
    var newstuff = scArray.join( scDelim );
    return newstuff;
    }

    Call the js function in an expression like this:
    $L.newstr=jscall("test.ats",$L.array," ")

    "test" in "test.ats" would be the name of the ScriptLibrary record.

    Good luck!
    Sam
Children
No Data