Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は試した:
var test = code.replace("-", "%2D");
ただし、code = "1-2-3" の場合は、1 つのダッシュのみが置き換えられます。両方を交換するにはどうすればよいですか?
使用する //
var test = code.replace(/-/g, "%2D");