replace character in string

Post here if you need help using Actiona
Post Reply
ilcergio
Posts: 17
Joined: 09 Oct 2017, 12:01

replace character in string

Post by ilcergio »

Hi, I have a variable with the text 1111 1111 3333 4444 and I want to pass it to another variable replacing the blanks by -
1111-1111-3333-4444
I thank you very much for the help
francois
Posts: 456
Joined: 18 Oct 2010, 10:33
Location: France

Re: replace character in string

Post by francois »

Hi,

an example :

Code: Select all

var re = / /g;
var chn_1 = "1111 1111 3333 4444";
var chn_2 = chn_1.replace(re,'-');
Console.print(chn_2)
ilcergio
Posts: 17
Joined: 09 Oct 2017, 12:01

Re: replace character in string

Post by ilcergio »

thank you very much francois
MDLE46
Posts: 108
Joined: 11 Nov 2016, 19:06

Re: replace character in string

Post by MDLE46 »

Google translation.

Hello,

For beginners information: to learn javascipt, I recommend the site MDN web docs (from Moz://a).

link: https://developer.mozilla.org/en-US/doc ... /@@replace

This case study is very well explained.

Cordially.
MDLE46
MDLE46
Posts: 108
Joined: 11 Nov 2016, 19:06

Re: replace character in string

Post by MDLE46 »

Google translation

And the direct link for javascript methods : https://developer.mozilla.org/en-US/docs/Web/JavaScript

Cordially.
MDLE46.
Post Reply