LEN command

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
NoSwaze
Posts: 1
Joined: Mon May 03, 2021 11:39 pm

LEN command

Post by NoSwaze » Mon May 03, 2021 11:41 pm

I'm struggling to work out how to use the LEN command to work out the amount of characters a word that the user enters has. Could anyone give me an example on how to do it please?

garmeister
Posts: 29
Joined: Sat Apr 10, 2021 6:56 pm

Re: LEN command

Post by garmeister » Tue May 04, 2021 12:20 am

isn't 'len' a Python method? I believe LiveCode uses 'length'

Example: the length of "ABC" -- returns 3

garmeister
Posts: 29
Joined: Sat Apr 10, 2021 6:56 pm

Re: LEN command

Post by garmeister » Tue May 04, 2021 12:28 am

Gary E Chike DMD
"Experience is what you get when you don't get what you want"

garmeister
Posts: 29
Joined: Sat Apr 10, 2021 6:56 pm

Re: LEN command

Post by garmeister » Tue May 04, 2021 12:44 am

I'm not sure if this is what you're trying to do or if there is a better way. I'm learning LC myself.

I wrote this bit of code and it works :D

Code: Select all

on mouseUp pButtonNumber
   ask "Enter some text"
   put it into aWord
   answer "Your text has " & length(aWord) & " letters in it."
end mouseUp
Attachments
LiveCode_length.jpg
Gary E Chike DMD
"Experience is what you get when you don't get what you want"

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: LEN command

Post by FourthWorld » Tue May 04, 2021 2:01 am

Hello, NoSwaze. What are you building with LiveCode?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9580
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: LEN command

Post by dunbarx » Tue May 04, 2021 2:41 am

Going back to the beginning, "len" is a synonym for "length". I don't particularly like it, and never use it.

Craig

garmeister
Posts: 29
Joined: Sat Apr 10, 2021 6:56 pm

Re: LEN command

Post by garmeister » Tue May 04, 2021 7:13 am

So, 'len' is a synonym of 'length' afterall. Good to know :D
Gary E Chike DMD
"Experience is what you get when you don't get what you want"

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”