Hi Guys
Im new at macro and i need your help.
Im writing a macro i need a way to remove all the spaces of a value so that i can compare values.
i copy a value
getclipboard>part3
but the problem is that %part3% has spaces behind it.
say for example if i just wanted "test" as a value with no spaces behind how do i do that.
Help removing space from a value
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
StringReplace>part3,SPACE,,part3
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
trim removes trailing spaces
The problem with StringReplace is that it removes embedded spaces as well which could be a problem. RTrim only removes the trailing spaces.
[code]
VBStart
VBEnd
Let>part3=program files%SPACE%
//This removes ALL spaces
//StringReplace>part3,SPACE,,part3
//Escape the double quotes if necessary
StringReplace>part3,","",part3
//This only removes spaces at the end of the string
VBEval>RTrim("%part3%"),part3
MessageModal> |%part3%|
[/code]
[code]
VBStart
VBEnd
Let>part3=program files%SPACE%
//This removes ALL spaces
//StringReplace>part3,SPACE,,part3
//Escape the double quotes if necessary
StringReplace>part3,","",part3
//This only removes spaces at the end of the string
VBEval>RTrim("%part3%"),part3
MessageModal> |%part3%|
[/code]
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
In v12 to remove trailing spaces:
RTrim>part3,part3
To remove leading spaces:
LTrim>part3,part3
To remove leading and trailing spaces:
Trim>part3,part3
Or to remove ALL spaces as per my last post:
StringReplace>part3,SPACE,,part3
RTrim>part3,part3
To remove leading spaces:
LTrim>part3,part3
To remove leading and trailing spaces:
Trim>part3,part3
Or to remove ALL spaces as per my last post:
StringReplace>part3,SPACE,,part3
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?