concatenateBytes()

The vgLib.concatenateBytes() system function concatenates two variables without regard to content. When two values are concatenated, the following actions occur:
  1. Any trailing spaces or nulls are deleted from the target value.
  2. The source value is appended to the value produced during Step 1.
  3. If the concatenated output from Step 2 is longer than the target parameter, the output is truncated. If the output is shorter than the target parameter, the output is padded with spaces, even if the output is a number.

vgLib.concatenateBytes() is one of a number of functions maintained for compatibility with earlier versions. New code can use standard EGL operators for these purposes.

Syntax

  vgLib.concatenateBytes(
    target HEX inOut,
    source HEX inOut)
  returns (result INT)
target
Any value that is reference compatible with HEX, to which the contents of source are concatenated.
source
Any value that is reference compatible with HEX, which EGL adds to target.
result
One of the following integer values:
-1
Concatenated string is too long to fit in the target field and characters other than nulls or spaces were truncated from the result.
0
Concatenated string fits in the target field.

Example

The following example shows the vgLib.concatenateBytes() function:

phrase, ormeme CHAR(7);
result INT;
phrase = "and/  ";
ormeme     = "or";
result = vgLib.concatenateBytes(phrase,ormeme);
if (result == 0)
    SysLib.writeStdout("***"+phrase+"***"); // phrase = "and/or "
end

Feedback