About StringSplit: why can't I use a static array?
Example from the help
string to_split="мама_мыла_раму"; // строка для разбивки на подстрокиstring sep="_"; // раздедитель в виде символаushort u_sep; // код символа разделителяstring result[3]; // массив для получения строк//--- получим код разделителя
u_sep=StringGetCharacter(sep,0);
//--- разобьем строку на подстрокиint k=StringSplit(to_split,u_sep,result);
//--- выведем комментарий PrintFormat("Получено строк: %d. Использован разделитель '%s' с кодом %d",k,sep,u_sep);
//--- теперь выведем все полученные строкиif(k>0)
{
for(int i=0;i<k;i++)
{
PrintFormat("result[%d]=%s",i,result[i]);
}
}
It works, but it generates error 4007. It looks like there should be enough memory and no need to change the size... I don't understand.
Silent: I asked why, and highlighted where (changed).
It is not clear with static arrays in general, when and how to apply them. It seems that I don't want to leave the compiler to its mercy, and I don't want to encounter such problems - it seems to work, but there are errors.
Silent: It is not clear with static arrays in general, when and how to use them. It seems that I don't want to leave the compiler to its mercy, and I don't want to encounter such problems - it seems to work, but there are errors.
And you try to study this or that subject when you need it. As soon as you reach the point in your system when you need these or those "levers" (functions), then start experimenting with them. I've found that this method of learning (in my case) works quite well.))
About StringSplit: why can't I use a static array?
Example from the help
It works, but it generates error 4007. It looks like there should be enough memory and no need to change the size... I don't understand.About StringSplit: why can't I use a static array?
Example from the help file
It works, but it generates error 4007. It seems to be enough memory and it doesn't need to be resized... I don't understand.Does the help say "mum washed the frame" too? If you're referring to an example from the help, give us a link to the example as well.
You won't believe it...
StringSplit
You won't believe it...
StringSplit
There is no such thing as an array declared string result[3]; There is an error in the link, because:
"Not enough memory to redistribute the array or an attempt to resize the static array!"
There is no such thing as an array declared string result[3]; There is an error in this.
I asked - why, and highlighted - where (changed).
I asked why, and highlighted where (changed).
Because you declared the array to be static - 3. And the resulting substring has more than 3 characters.
Static [3] is 3 (sub)lines, not 3 characters, I thought.
Yes, if you remove up to 3 letters
that's not the point.It is not clear with static arrays in general, when and how to use them. It seems that I don't want to leave the compiler to its mercy, and I don't want to encounter such problems - it seems to work, but there are errors.