Ok I’ll try to make this somewhat intelligible. A lot of the time I have extremely long random strings like:
09 qh sf kb09 gz 85wx85 2bs9yj 09 cts9yje7 ud
Only they’re much longer.
My problem is that I need to replace all of the spaces with something like:
:1/
However; with each consecutive space, I want the number to increase by one, so that the string will look like:
09:1/qh:2/sf:3/kb09:4/gz:5/85wx85:6/2bs9yj:7/09:8/cts9yje7:9/ud:10/
I have a working script that uses a lot of text item delimiters and lists, but it’s incredibly long, slow, and inefficient. If it’s possible, I’m trying to get my script to only use strings.
I think I’m almost there. I know what line is causing the problem in my new script, but I dont know how to fix it.
set thePrompt to display dialog "Enter the String here." default answer ""
set returnedInput to text returned of thePrompt
set newVar to returnedInput
considering case
set NU to 1
set CountString to count newVar
set theInputString to text of newVar
repeat CountString times
set currentLetter to item NU of theInputString
if currentLetter is equal to " " then
set ReplaceLetter to ":" & NU & "/"
set currentLetter to ReplaceLetter --??? This is the problem. :NU/ won't replace " ".
end if
set NU to NU + 1
end repeat
return theInputString
end considering
Any help is appreciated.
Model: iMac
Operating System: Mac OS X (10.8)