• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Concluding that a delimiter was not present in original string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Concluding that a delimiter was not present in original string


  • Subject: Re: Concluding that a delimiter was not present in original string
  • From: Paul Skinner <email@hidden>
  • Date: Tue, 17 Jun 2003 18:16:45 -0400

Your code is reasonable. Although...

if the length of theParts is 1 then

...is, perhaps, more readable.

Paul

On Tuesday, June 17, 2003, at 05:46 PM, Gary Lists wrote:

So sorry for the no subject post.
====
If one is using TIDs to split text chunks, is it a reasonable conclusion
that if the number of text items returned is 1 then the delimiter was not
even found in the string?

For example, is this generally reasonable?

set x to "abcde"

set theParts to splitString(x, "5") -- [1]
if number of items of theParts is 1 then
display dialog "That splitter is not found in the string."
else
return theParts -- which would be {"abcde"} if returned
end if

Or is it better to record the original string length, then check the length
of the first returned item and compare them...if they are equal in length,
or even the same value, then the split never occurred?

Advice appreciated.
--
Gary


[1]
-- John Delacour's TID handlers
-- see AS-Users List archive at 2003-June-16
-- thread "Why save text item delimiters? Philosophical question...."
on splitString(_string, _cut)
set my text item delimiters to _cut
set ls to text items of _string
set my text item delimiters to ""
return ls
end splitString


MacOS 9.1 / "9 is Fine"
OMM: osa:AS 183 / osa:JS 103 / FM 55 / BB 612 / Smile 188
______________________________________________________________
Please reply directly to the list.
Incoming messages are auto-deleted. (It's anti-spam, that's all.)
_______________________________________________
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.
_______________________________________________
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.

References: 
 >Concluding that a delimiter was not present in original string (From: Gary Lists <email@hidden>)

  • Prev by Date: Re: A script to create another script
  • Next by Date: Re: osascript and dialogs
  • Previous by thread: Concluding that a delimiter was not present in original string
  • Next by thread: Programatically determining default browser?
  • Index(es):
    • Date
    • Thread