CreateString (FUN)ΒΆ

FUNCTION CreateString : IString

Returns a IString instance placed in the memory area given by the parameters.

Example for a 80 byte IString instance:

udiCapacity : UDINT; // Capacity of the new String
axwMemory : ARRAY[0..(SIZEOF(_UTF8String)+79) / SIZEOF(__XWORD)] OF __XWORD;
itfString : IString := CreateString(ADR(axwMemory), SIZEOF(axwMemory), 0, udiStrSize=>udiCapacity);
InOut:

Scope

Name

Type

Initial

Comment

Return

CreateString

IString

Input

pbyMemory

POINTER TO BYTE

Pointer to the first byte of the memory.
This address should aligned to a __XWORD boundary!

udiMemSize

UDINT

Size of the allocated memory for the string.
This also includes the memory for the _UTF8String instance, so the function block of string instance.
If e.g. a 80 byte string is requred than memory size would be SIZEOF(STR._UTF8String) + 80

psValue

POINTER TO BYTE

0

optional address of a utf-8 encoded, zero terminated byte array (string), used as inital value

Output

udiStrSize

UDINT

The capacity in bytes of the new IString instance

eErrorID

ERROR