How to delete text items?
How to delete text items?
- Subject: How to delete text items?
- From: email@hidden
- Date: Tue, 5 Mar 2002 18:59:21 EST
Martin,
One solution is that you could create a second string-type variable (let's
call it CleanedComment), and then read the comment field one character at a
time into CleanedComment, passing through a decision step inbetween to verify
the character is valid or if it needs to be substituted. It's time consuming
by comparison to some of the other techniques, but very rudimentary for
explaining the concept:
local CleanedComment
local GenericLoopController
local CharToTest
on ConvertCommentField(OriginalCommentString)
-- initialize CleanedComment
set CleanedComment to ""
-- grab the length of the original comment field
set OriginalCommentLength to the length of OriginalCommentString
-- start the loop, to loop through each character of the original comment
string
repeat with GenericLoopController from 1 to OriginalCommentLength
-- set the character we're working with to the appropriate character
set CharToTest to character GenericLoopController of
OriginalCommentString as string
-- test the character to see if it is invalid, if so substitute a dash
if ((CharToTest = ":") or (CharToTest = "/")) then
set CharToTest to "-"
end if
-- add the character (either the original or the replacement) to the
new string
set CleanedComment to (CleanedComment & CharToTest)
-- close out the loop
end repeat
-- send back the new string that has no colons or forward slashes
return CleanedComment
end ConvertCommentField
=-= Marc
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.