This is the input given "S H A N N O N B R A D L E Y"
(single space between each letter but 2 space between SHANNON and BRADLEY)
I want output to be in this format (given below)
SHANNON BRADLEY
Any way to do this in R or Python
Select one or several columns with the data to delete spaces between words. Press Ctrl + H to get the " Find and Replace " dialog box. Press the Space bar twice in the Find What field and once in Replace With Click on the " Replace all " button, and then press Ok to close Excel confirmation dialog.
In Microsoft Word, press CTRL + H to access the find-and-replace tool. In Adobe InDesign, press CTRL + F while any text frame is active to open the Find/Replace box. This article explains how to find double spaces and replace them with single spaces using a variety of programs.
1 Text Indentation 2 Letter Spacing. The letter-spacing property is used to specify the space between the characters in a text. 3 Line Height 4 Word Spacing. The word-spacing property is used to specify the space between the words in a text. 5 White Space. The white-space property specifies how white-space inside an element is handled.
In the program in which you're working, press the Search and Replace hotkey or its equivalent. Search for two spaces and set it to replace with a single space. Run this procedure several times, until your program advises you that no more occurrences of a double-spaced character set were found.
try this in R
text <- c("S H A N N O N B R A D L E Y")
gsub(" (?! )" , text , replacement = "" , perl = T)
this is another simpler one
gsub("\\b " , text , replacement = "" , perl = T)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With