Replace white space in a string with \"-\"


/ Published in: ActionScript 3
Save to your folder(s)

Replace "-" with anything you want to. Useful for amending URLs.


Copy this code and paste it in your HTML
  1. yourString = yourString.replace(/\s+/g, '-');

URL: http://gromitski.com/blog/replacing-white-space-in-a-string/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.