Javascript: s/digit/" " x that digit/g

Posted by Full Decent on Stack Overflow See other posts from Stack Overflow or by Full Decent
Published on 2010-05-27T23:27:14Z Indexed on 2010/05/27 23:31 UTC
Read the original article Hit count: 178

Filed under:

I would like to match a digit and replace it with that many spaces. Can this be done in less than 9 lines of code?

Example

"asnthsnth4nts4h3n" --> "asnthsnth    nts    h   n"

© Stack Overflow or respective owner

Related posts about JavaScript