HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

maximum string length?

01-30-2004, 11:50 PM#1
Squashy
Does anyone know how many characters maximum you can have in a string in JASS?
01-31-2004, 12:13 AM#2
weaaddar
2048 is what i'm told.
02-11-2004, 07:05 AM#3
RodOfNOD
I know in GUI its like 255. Also depends on if its a game text string or a regular string.
02-11-2004, 09:06 AM#4
Cubasis
Strings are oh-so-fun.

firstly, while Rod is right about GUI limiting them.... "strings" in it's true sense (a type/object) can hold 2048 symbols. BUT.... All non-asc-ii symbols (or whatever) like ÃÅ* or sumtin... takes "2" slots in the string.

F.ex., if you have a string with only that symbol, and you SubstringBJ( 1, 1 ) it, it will indeed return nothing.... not unless you do SubstringBJ( 1, 2 ) will it return the symbol.

There are also some more oddities about strings....

Cubasis
02-11-2004, 02:32 PM#5
Vexorian
Besides of what you all said, certain natives seem to have a 255 limit of lenght for the strings they take, I am mostly for the SetMapMusic one.
02-11-2004, 08:36 PM#6
Starcraftfreak
@Lord Vexorian: Such long screens can't be displayed anyway (the map name, description, ...).
02-12-2004, 10:17 PM#7
jmoritz
War3 stores strings as multi-byte strings then. This means that most normal characters take 1 byte, while some (most importantly japanese, chinese, korean) take 2 bytes. Best practice would be to assume a maximum length of 1024 characters then.
02-12-2004, 10:31 PM#8
Vidstige
Quote:
Originally posted by jmoritz
This means that most normal characters take 1 byte, while some (most importantly japanese, chinese, korean) take 2 bytes. Best practice would be to assume a maximum length of 1024 characters then.

Wouldn't it be better to assume that any string could possibly be 2048 character, but only create strings with maximum 1024 characters. Otherwise long strings created by someone else could be chopped of.