how to adress the object name and not the number?
Dave
dave at looktowindward.com
Fri Apr 20 06:03:37 EDT 2007
On 20 Apr 2007, at 09:44, Bill Marriott wrote:
> Eric,
>
>>>>
> I prefer to name any object with a single word
> ("LastBackupDate5" for instance) and *always* quoted even if XTalks
> don't make it compulsory in this case.
> And to retrieve the right suffix, instead of using last word, I just
> use char x to -1:
> <<<
>
> Right! I always, always quote string literals as well, even though
> Rev will handle it for me if I don't.
>
> But on the other idea, this is exactly the problem I'm trying to
> solve. :) It's cumbersome because you've got the problem of a
> variant number of items and length of the label prefix.
>
> If you have more than 10 items (as in my example) you can't use
> digits 0-9 and instead have to force your numbering system to two
> digits. Rev doesn't comprehend "last 2 char" so you instead have to
> write something like
>
Just write a couple of Utility function like this:
------------------------------------------------------------------------
-
--
-- UtilStringPadLeft
--
------------------------------------------------------------------------
-
function UtilStringPadLeft theString,theStringMaxSize,thePadChar
local myString
put theString into myString
repeat while the length of myString < theStringMaxSize
put thePadChar & myString into myString
end repeat
return myString
end UtilStringPadLeft
------------------------------------------------------------------------
-
--
-- UtilStringPadRight
--
------------------------------------------------------------------------
-
function UtilStringPadRight theString,theStringMaxSize,thePadChar
local myString
put theString into myString
repeat while the length of myString < theStringMaxSize
put myString & thePadChar into myString
end repeat
return myString
end UtilStringPadRight
Then do:
put "ImameName" & UtilStringPadLeft(mySequenceNumber,4,"0") into
myImageName
All the Best
Dave
More information about the use-livecode
mailing list