May 14, 2024, 12:07:19 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


LEN problem

Started by Zen, January 12, 2006, 05:41:05 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Zen

Hi Paul.

With ibasic we could use len(string) to return the size of string but i get a compile error when i use it in Aurora. We could use sizeof() as an alternative maybe ;)

Lewis

Parker

I don't think IBasic allowed those, but I always wished they were. And LEN seems like a BASIC function, although for the length of strings it's great. sizeof() would be my preference for UDT size, and also built in, for example on 32 bit, sizeof(pointer) == 32, but 64 on a 64 bit computer.

Bruce Peaslee

Quote from: Lewis on January 12, 2006, 05:41:05 PM
Hi Paul.

With ibasic we could use len(string) to return the size of string but i get a compile error when i use it in Aurora. We could use sizeof() as an alternative maybe ;)

Lewis
I don't get an error. This works for string hex:


for (i=0; i<len(hex); i++)
{
value = value +
(instr("0123456789ABCDEF",mid$(hex,len(hex)-i,1))-1)*power(16,i);
}
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Parker

But he means literally, len(string), which should return 255, or the length of the string type. To avoid confusion is why I said sizeof() would be a good alternative.

Bruce Peaslee

Ok, that makes more sense.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles