converting a string with commas to a array with commas (or even just a number with commas

I’m using JS inside MaxMSP

I would like to take a string output (of separated by comma single fibonacci numbers) and convert it to either an array or number, keeping the space and commas but getting ride of the “double quotes”

I’ve tried a bunch of stuff here but unfortunately I’m still banging my head against the wall.

autowatch = 1;

inlets = 2;
outlets = 2;


function msg_int(num){

  var a = 1; 
  var b = 0, temp;


  while (num >= 0){
    temp = a;
    a = a + b;
    b = temp;
    num--;
    outlet(0, b);


    var n = temp;
    digits = n.toString().replace(/(\d{1})/g,'$1, ')
    outlet(1, digits);


  }
    return b;


}

The Input number is 14
The first outlet(0) number is 610
The second outlet(1) is “6, 1, 0, “

I would like the second outlet to be 6, 1, 0,

132 thoughts on “converting a string with commas to a array with commas (or even just a number with commas”

  1. My developer is trying to persuade me to
    move to .net from PHP. I have always disliked the idea because of the
    expenses. But he’s tryiong none the less. I’ve been using WordPress on numerous websites for about a year and am concerned about
    switching to another platform. I have heard good things about blogengine.net.
    Is there a way I can import all my wordpress
    content into it? Any help would be really appreciated! http://herreramedical.org/acyclovir

    Reply

Leave a Comment