documentation organizational problems

Alex Tweedly alex at tweedly.net
Wed Jun 1 19:14:27 EDT 2005


Jon wrote:

> Brian:
>
> Thanks for your comments.  My problem was spending hours trying to 
> write a Flip routine, only to come across it by accident.  There was 
> no clue that it existed from looking at the Image properties or 
> events.  After this accidental encounter, I now feel as if I have to 
> learn every single detail before proceeding at all, which is daunting 
> and frustrating.  Thus my comment that associating the "methods" with 
> the objects would have been a good idea.  And if that was not possible 
> architecturally, at least document them somewhere.
>
> And then I tried to do some string manipulations (change the string 
> <"FRED"> to the string <FRED>, that is, remove the quotes), and simply 
> gave up: there is no section on how to manage strings.
>
> I know I'm coming from another programming environment, and I don't 
> expect it to be trivial, but when I can't find any information at all, 
> I get frustrated.  I can't be the first one...
>
> :)

Certainly not the first - see any email to this list from me between 
about June and August last year (then note the gradual change over to 
enthusiastic following that time :-)

The problem is that string manipulation is so well embedded into 
Transcript that it can be hard to find - it's not a separate string 
library like is in in some other places.

You could do any of   (assuming the string is currently in variable "myVar")

1. replace quote by empty in myVar

2.
   put empty into newVar
   repeat for each char c in myVar
      if c <> quote then put c after newVar
   end repeat

3. Use reg expressions  (too late at night to look up just how to do it 
and include a code fragment)

4. Lots of other creative (but not so good) ways, that you might be used 
to from other languages, such as

   repeat forever
      put offset(quote, myVar) > 0 into t
      if t = 0 then exit repeat
      delete char t of myVar
   end repeat

and surely at least a dozen other ways.

In general when looking for string manipulation, you might be looking 
for language constructs such as
   - char, word, item  (e..g char 3 to -5 of someVar)
   - offset, itemOffset, etc.
   - replace
  - filter (if working with lines - and note that you can change the 
lineDelimeter)
 - regular expr  (matchText, etc)
  - etc.

When in doubt - ask. This list is pretty busy (and I've spent today 
adding clutter to it :-), so an extra question or two isn't a problem, 
and you'll usually get the answer you need quickly; it may still be 
frustrating, but it's worth it ...

-- 
Alex Tweedly       http://www.tweedly.net



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.322 / Virus Database: 267.3.0 - Release Date: 30/05/2005



More information about the use-livecode mailing list