Become a MacRumors Supporter for $25/year with no ads, private forums, and more!
  • Did you order new AirTags? We've opened a dedicated AirTags forum.

Frank M

macrumors member
Original poster
Aug 20, 2019
68
4
New Jersey
7/7/20

I have a string of characters in my shortcut with a value of
“ ApplePay transactions”.

Using the Replace action (replace a space with nothing) I can get “ApplePaytransactions” but I want
the final string to be
“ApplePay transactions”.

Any help would be greatly appreciated.

Frank M
 

chabig

macrumors 604
Sep 6, 2002
7,894
5,230
Take two steps:

1. Delete the spaces as you've already done
2. Replace "yt" with "y t"
 
Comment

Frank M

macrumors member
Original poster
Aug 20, 2019
68
4
New Jersey
Take two steps:

1. Delete the spaces as you've already done
2. Replace "yt" with "y t"

Thanks for you quick reply.

Your solution is fine for the string in question but what if I don’t know the value of the string beforehand.

Frank M
 
Comment

chabig

macrumors 604
Sep 6, 2002
7,894
5,230
You could do it one step if you can identify the space at the beginning of the line. One way would be with some kind of wildcard, like " *".
 
Comment

Frank M

macrumors member
Original poster
Aug 20, 2019
68
4
New Jersey
Thanks for you quick reply.

Your solution is fine for the string in question but what if I don’t know the value of the string beforehand.

Frank M

After much trial and error I finally came up with a solution to trim spaces from a string (in this case a Shortcut name).

If interested here is a link to the shortcut in question.


Frank M
 
Comment
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.