amount of characters question

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Pistris
Posts: 148
Joined: Mon Jul 20, 2015 2:40 am

amount of characters question

Post by Pistris » Wed Oct 30, 2019 11:16 pm

Hi Guys

How do I get the amount of characters in a field (including spaces)

Thanks in advance

Edd

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: amount of characters question

Post by [-hh] » Wed Oct 30, 2019 11:41 pm

put length(field "Name") into tL
[and please read the entry to length in the dictionary for more info]
shiftLock happens

Pistris
Posts: 148
Joined: Mon Jul 20, 2015 2:40 am

Re: amount of characters question

Post by Pistris » Wed Oct 30, 2019 11:48 pm

Thank you -hh
I missed it, I was looking under properties of a field
the dictionary is not that easy to use

Edd

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: amount of characters question

Post by [-hh] » Thu Oct 31, 2019 12:16 am

Edd,
you are right. What I meant with "read that in the dict" was to see the equivalent:
the number of chars in field "Name"
and all the synonyms (the length of, len(), the num of chars in etc.).

In LC Script any "amount of" question has mostly a "number of" answer ;-)
shiftLock happens

Pistris
Posts: 148
Joined: Mon Jul 20, 2015 2:40 am

Re: amount of characters question

Post by Pistris » Thu Oct 31, 2019 12:39 am

Thanks man :)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: amount of characters question

Post by dunbarx » Thu Oct 31, 2019 3:10 am

hi.

Know that the "number" of things, like Hermann mentioned, is one of the fundamental gadgets in LC. You can ask for the number of words, buttons, cards, almost any "noun" in the language. The context changes, of course, if you are trying to find out the number of buttons on a card, as opposed to the number of words, say, in a variable or field, or characters, as you did.

The point is that if you wanted to know the number of characters in a field, that is not a property of that field. It is a function. The distinction is sometimes hard to distinguish.

Just don't try to ask for the number of numbers in "12345". :wink:

Craig

Post Reply