Check the Length of an variable
Posted: Tue Feb 07, 2006 4:16 pm
by Pixbyte
Hello,
I do not find any real hint how to check an variable about its length. Like I want to check if the Variable is 30 chars long. But how? if someone have an short example I will be pleased.
Ingo
Posted: Tue Feb 07, 2006 4:33 pm
by CandiceJones
Hi!
I made a small scriptlet for you:
Code: Select all
~InstallAware Clipboard Data~
~Comment~
~{28A232ED-0D60-48D9-B190-0825D7B8DD34}~
~~
~End~
~{E9221C17-3FCE-4124-887B-BA0A7F00BA8F}~
~End~
~{063C8ED9-1A19-4C0C-BDC8-9FBA5F67723C}~
~MessageBox~
~{5D9781C0-F58A-4536-A087-501B7CD4B1DE}~
~Verified!~
~This variable is EXACTLY 30 characters long!~
~0~
~1~
~~
~Comment~
~{C3C95C95-1714-401F-8B3A-EEED92A0A970}~
~Verified NOT shorter than 30 chars~
~If~
~{267C0955-BF9C-465B-A6C5-D9CA4A77A575}~
~PART2~
~0~
~~
~FALSE~
~Parse String~
~{BED486B3-5292-4E0F-AE81-60BE89BC1BAD}~
~$TEST$~
~30~
~PART1~
~PART2~
~3~
~FALSE~
~FALSE~
~Comment~
~{40D940E1-33C5-4526-BA3F-0B762C4346F4}~
~Verified NOT longer than 30 chars~
~If~
~{C325980B-0320-4CF9-8456-6E31FD666B76}~
~PART2~
~0~
~~
~FALSE~
~Parse String~
~{BA77BA73-8A37-45B6-9868-5EF4FAAF4A85}~
~$TEST$~
~30~
~PART1~
~PART2~
~2~
~FALSE~
~FALSE~
~Comment~
~{3AA1D017-5D65-47D1-9960-2E442864D917}~
~See if longer than 30 chars~
~Set Variable~
~{9CDE776E-EF16-4AC8-8A2F-D9584F94DADD}~
~TEST~
~123456789012345678901234567890~
~Comment~
~{580CF52B-8EB0-4359-A2F8-32F5A292BC62}~
~Create 30 char variable~
Here is the human readable version of this code:
Code: Select all
// Create 30 char variable
Set Variable TEST to 123456789012345678901234567890
// See if longer than 30 chars
Parse String $TEST$ into Variables PART1 and PART2 (Split at position from start)
if Variable PART2 Equals
// Verified NOT longer than 30 chars
Parse String $TEST$ into Variables PART1 and PART2 (Split at position from end)
if Variable PART2 Equals
// Verified NOT shorter than 30 chars
MessageBox: Verified!, This variable is EXACTLY 30 characters long!
end
end
Posted: Tue Feb 07, 2006 4:40 pm
by Pixbyte
WOW! Fast and good. Many thanks for it. A suggestion, add something like this to your help file.
Ingo
BTW: Good luck with MV, I know their legal wildcards very good
