Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2022 11:06 PM
Hi,
I have a requirement to replace underscore (_) in a text field with -, how can I do this.
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2022 11:13 PM - edited ‎12-15-2022 11:24 PM
Try this.
var s = "sdfsdf_ddddd_dfdf"
s = s.replaceAll("_","-")
gs.info(s)
// replaceAll may not work with some browsers.. use the below code instead....
var s = "sdfsdf_ddddd_dfdf"
s = s.replace(new RegExp("_","g"),"-")
gs.info(s)
Please mark my answer as correct and helpful based on Impact.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2022 11:13 PM - edited ‎12-15-2022 11:24 PM
Try this.
var s = "sdfsdf_ddddd_dfdf"
s = s.replaceAll("_","-")
gs.info(s)
// replaceAll may not work with some browsers.. use the below code instead....
var s = "sdfsdf_ddddd_dfdf"
s = s.replace(new RegExp("_","g"),"-")
gs.info(s)
Please mark my answer as correct and helpful based on Impact.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2022 11:25 PM
I modified my first post ...read it one more time~~~ important!!
Please mark my answer as correct and helpful based on Impact.