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 spacecharacter, in the Find what: zone -
Type in a
,character, in the Replace with: zone -
Select the
Normalsearch mode -
Click on the
Replace Allbutton
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,3Here 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 expressionsearch mode -
Click on the
Replace Allbutton
And, magically, you get the expected output :
15,21,24,32,65,11,3 07,25,39,40,47,20,3Best Regards,
guy038
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login