IonicWind Software

Aurora Compiler => General Discussion => Topic started by: Zen on January 12, 2006, 05:41:05 PM

Title: LEN problem
Post by: Zen 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
Title: Re: LEN problem
Post by: Parker on January 12, 2006, 05:57:15 PM
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.
Title: Re: LEN problem
Post by: Bruce Peaslee on January 12, 2006, 05:58:53 PM
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);
}
Title: Re: LEN problem
Post by: Parker on January 12, 2006, 06:00:27 PM
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.
Title: Re: LEN problem
Post by: Bruce Peaslee on January 12, 2006, 06:01:18 PM
Ok, that makes more sense.