Re: Using AppleScript to Detect Nul Characters
Re: Using AppleScript to Detect Nul Characters
- Subject: Re: Using AppleScript to Detect Nul Characters
- From: kai <email@hidden>
- Date: Sat, 30 Apr 2005 17:25:34 +0100
On Saturday, April 30, 2005, at 03:57 pm, Bernardo Hoehl wrote:
[snip]
As a novice high-level programmer, I did not know that every character
is represented by a hex value, and that I had two "gremlins" in my
Template text (used to send out the emails after text manipulation), I
mean, I had two hex values = 00.
[snip]
As I move on forward with my learning, I am wondering if there is an
"AppleScript way" I can use to detect these Gremlins, and so create a
routine in my application to check the consistency of any text I use
for sending out emails.
Do you mean something like this, Bernardo?
-----------------
to stripEveryCase of c from t
set d to text item delimiters
set text item delimiters to c
if (count t's text items) > 1 then
set t to t's text items
set text item delimiters to ""
set t to t as string
end if
set text item delimiters to d
t
end stripEveryCase
stripEveryCase of (ASCII character 0) from someText
-----------------
To test with a visible character:
-----------------
set someText to "Mary *had* a little lamb**"
stripEveryCase of "*" from someText
--> "Mary had a little lamb"
-----------------
If you just want to check for the presence of a particular character
(but not remove it):
-----------------
(ASCII character 0) is in someText
--> true or false
-----------------
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden