How to replace spaces with commas
-
Hi, I want to replace my spaces with commas. Every time, I put “replace all” it replaces the spaces with commas, but it forms just a single line. I still want to keep the same format. How do I do that? Thank you for your help.
Input:
15 21 24 32 65 11,3
07 25 39 40 47 20,3Desired Output:
15, 21,24,32 ,65,11,3
07,25, 39, 40,47,20,3Instead Of:
15, 21,24,32 ,65,11,3,07,25, 39, 40,47,20,3 -
Hello, @angelica-sarina,
I don’t really understand how your search/replacement could have gotten rid of all the line-breaks !
Indeed, assuming the input text, below :
15 21 24 32 65 11,3 07 25 39 40 47 20,3
-
Open the Replace dialog
Ctrl + H
-
Type in a
single space
character, in the Find what: zone -
Type in a
,
character, in the Replace with: zone -
Select the
Normal
search mode -
Click on the
Replace All
button
And you obtain the output :
15,21,24,32,65,11,3 07,25,39,40,47,20,3
Now, if your numbers may be separated by more than one space, as below :
15 21 24 32 65 11,3 07 25 39 40 47 20,3
Here is a second solution :
-
Open the Replace dialog
Ctrl + H
-
Type in a
\x20+
character, in the Find what: zone -
Type in a
,
character, in the Replace with: zone -
Select the
Regular expression
search mode -
Click on the
Replace All
button
And, magically, you get the expected output :
15,21,24,32,65,11,3 07,25,39,40,47,20,3
Best Regards,
guy038
-