capital letter

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Preston Shea
Posts: 73
Joined: Sat Apr 08, 2006 6:51 pm
Location: New Hampshire, USA

capital letter

Post by Preston Shea » Thu Mar 17, 2011 1:39 am

How do I go through field fA copying only those lines that begin with a capital letter to field fB?
In nova fert animus mutatas dicere formas corpora.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4003
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: capital letter

Post by bn » Thu Mar 17, 2011 1:55 am

Hi Preston,

Code: Select all

on mouseUp
   put field "fA" into tData
   repeat for each line aLine in tData
      put charToNum(char 1 of aLine) into tCapital
      if tCapital > 64 and tCapital < 91 then put aLIne & cr after tCollect
   end repeat
   delete last char of tCollect
   put tCollect into field "fB"
end mouseUp
works for English, it is not taking into account accented or umlaut characters. Works only on real lines, not apparent lines if they are the result of a line wrap.
ASCII 65 = capital A ASCII 90 = capital Z
Kind regards

Bernd

Post Reply

Return to “Talking LiveCode”