Remove space at the end or beginning of the clipboard contents Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
HiSoKa
Posts: 480
Joined: 27 Jan 2020, 15:43

Remove space at the end or beginning of the clipboard contents

28 Oct 2021, 09:30

Hello,
Sometimes I copy text, But when I copy it, It also copies Space after the last letter of the word or sentence and sometimes before the first letter,
This is the code that I came up with,

Code: Select all

F1::
	Clipboard := RegexReplace(Clipboard, " ", "")
Return

Esc::ExitApp
But the problem with this code is that it deletes spaces even if it is in the middle or between words.
In my case, I just want to delete the Spaces If only it existed before the beginning of the first letter or after the end of the last letter.

This might be the best way to achieve this goal is use RegExReplace() but unfortunately I have no experience with this.

Thanks in advance...

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Lamron750, septrinus, songdg and 262 guests