Remove 1 Or +1 from the Phone Numbers list

Comments

1 comment

  • Rainer Grabowski

    Hi,

    regex isn't needed.

    var i,n,n_clean,
    p = @phone field.map(function (obj) { return obj.value}),
    p_clean = [];
    for(i = 0; i < p.length;i++){
         n = p[i].substr(0,1);
         n_clean = n == "1" ? p[i].substr(1) : n == "+" ? p[i].substr(2) : p[i];
      p_clean.push(n_clean);
    }
    p_clean.join()

     

     

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk