Space between letters and punctuation marks

Get help with using AutoHotkey and its commands and hotkeys
EmmaEmily
Posts: 28
Joined: 25 Sep 2019, 05:30

Space between letters and punctuation marks

13 Apr 2020, 14:41

Hallo there,

Code: Select all

;
strSpaceBefore := "I am EmmaEmily,  here in the forum:  My name was inspired by a famous pop-group!"
strSpaceAfter := "I am EmmaEmily ,  here in the forum  :  My name was inspired by a famous pop - group ! "
; and vice versa:
strSpaceBefore := "I am EmmaEmily ,  here in the forum  :  My name was inspired by a famous pop - group ! "
strSpaceAfter := "I am EmmaEmily,  here in the forum:  My name was inspired by a famous pop-group!"

What do you have to do if the punctuation marks should have a space between them and a letter?
And how does it work vice versa?

Thanks a lot for your help and advice.
User avatar
Scr1pter
Posts: 1200
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: Space between letters and punctuation marks

13 Apr 2020, 17:03

Hallo,

Try this and let us know:

Code: Select all

F1::
strSpaceBefore := "I am EmmaEmily,  here in the forum:  My name was inspired by a famous pop-group." ; Example string
Clipboard := RegExReplace(strSpaceBefore, "[,!:.-?]", " $0") ; Replace all these characters by "Space+character"
Clipboard := StrReplace(Clipboard, " -", " - ") ; Add a space after -
return
Viele Grüße
Please use [code][/code] when posting code!
Keyboard: Logitech G15 FE - Mice: Logitech G9 FE, G502 FE, G602, Jelly Comb Touchpad - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.32.00

Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot], mikeyww, RubbeH and 49 guests