Page 1 of 1 1
Topic Options
#168543 - 2006-09-27 03:58 PM String Length limit
GSUK Offline
Starting to like KiXtart

Registered: 2004-03-10
Posts: 125
Hi there,

I was just wondering is there is a limit to the number of charachters you can store in a string?

Thanks.

Top
#168544 - 2006-09-27 04:17 PM Re: String Length limit
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
It is in the documentation:

Variable types
In KiXtart, variables are always of one fundamental data type: Variant. The current implementation of KiXtart uses three types of variants: long integers, doubles (8-byte floating point numbers) and strings. A variant of type string can contain up to 32,000 characters. Integer variables can contain any value between 2,147,483,648 and 2,147,483,647. The type of a variable is automatically changed to the result of the expression that is assigned to it. This means that if you assign a string to a variable containing an integer, the type of the variable is changed to a string.

There is no limit to the number of variables that can be defined, other than the amount of memory available to KiXtart.

Note that KiXtart can handle other types of variants, such as Booleans, Bytes, etc. KiXtart itself does not create these types, but they may be returned by other programs via COM automation. If any of these types of variants is used in an expression, it will be converted to the appropriate type before the expression is evaluated.

Top
#168545 - 2006-09-27 05:22 PM Re: String Length limit
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
32000 limit in strings is not true anymore...

You can have string MUCH longer than 32000 you just cant display them. but you can preform substr() commands on them jsut fine.

Also it seems that the limit of displaying a string is 26608 any thing longer than that will not be displayed.

Code:

dim $string[26608]
$string = join($string,'.')
? len($string)
? $string



Also this bit of code shows that the LEN if a sting looks to be limited by the ammount of ram, or 2,147,483,648... what ever happens first... my own system was only able to get a string len() of 33,554,432 before it ran out of ram and started crawling really slow! but the script was still running!

Code:
$string = '.'
while not @error
$string = $string + $string
? len($string)
loop


Top
#168546 - 2006-09-27 05:51 PM Re: String Length limit
GSUK Offline
Starting to like KiXtart

Registered: 2004-03-10
Posts: 125
THat sounds more than ample! I was worried it might be 256!
Top
#168547 - 2006-09-27 07:49 PM Re: String Length limit
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
ran this code on my more powerful system at my other office...

Code:

$string = '.'
while not @error
$string = $string + $string
? len($string)
loop



it gave me the following

Code:

2
4
8
16
32
64
128
256
512
1024
2048
4096
8192
16384
32768
65536
131072
262144
524288
1048576
2097152
4194304
8388608
16777216
33554432
67108864
134217728
268435456
ERROR : out of memory!
Script: C:\kix\sandbox\test.kix
Line : 4


Top
#168548 - 2006-09-27 07:51 PM Re: String Length limit
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
and how much memory did it have?
I think you already knew but the computer powerfulness is not a factor as much as the available memory

Top
#168549 - 2006-09-27 07:52 PM Re: String Length limit
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
1.5g of ram on this system, the other system only had 256m

Edited by Bryce (2006-09-27 07:54 PM)

Top
#168550 - 2006-09-27 08:22 PM Re: String Length limit
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ok.
could get further by adding parts to the string, instead of doubling it every round.

Top
#168551 - 2006-09-27 08:35 PM Re: String Length limit
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Like so.

Golfed it by 4 strokes

Code:

$string = '.'
While NOT @error
$string = $string + '.'
? Len($string)
Loop



[edit]
Could take some time to get into the really big numbers this way
[/edit]


Edited by Mart (2006-09-27 08:41 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#168552 - 2006-09-27 08:49 PM Re: String Length limit
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
now this is weird...

Code:
dim $string[10000000]
? ubound($string)
$string = join($string,'.')
? @error @serror
? len($string)



taht will create a 10000000 len string, after running a LONG time...

chance that dim to 20000000 and the script just ends... no error...

change that dim to 40000000, and you get error 87 "The parameter is incorrect." from the Join() command.

weird....

Top
#168553 - 2006-09-27 09:19 PM Re: String Length limit
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
those kixtart ending without any error or anything... those thingies are weird.

there clearly are some exceptions which ruud and MS hasn't trapped.
and then the incorrect parameter makes no sense.
those errors are the outcome of the previous, untrapped error conditions.
doesn't hurt much with this type of script but is really painfull with more complex stuff.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 764 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.102 seconds in which 0.058 seconds were spent on a total of 11 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org