CStr(array()) Function

Purpose

Converts a Byte or String array to a string.

Syntax

$ = CStr(a())

a():array of any type

Description

If a() is a byte array, CStr() creates a string of length Dim?(a|()) with the values of the elements of the array.

If a() is a string array, CStr() creates a string by adding all elements of the array and separating them with #13#10 (CRLF).

If a() is of any other type, the length of the string is Dim?(a()) * SizeOf(type).

Example

Dim b(0 .. 6) As Byte

b(0) = Asc("T")

b(1) = Asc("e")

b(2) = Asc("s")

b(3) = Asc("t")

b(4) = Asc("i")

b(5) = Asc("n")

b(6) = Asc("g")

Print CStr(b()) // Prints "Testing"

or

Dim bw() As Word

Array bw() = "Testing_"

Print Dim?(bw()) // Prints 4

Print CStr(bw()) // Prints "Testing_"

Remarks

Array a()= $ is the reverse of $ = CStr(a())

See Also

Array ()=

{Created by Sjouke Hamstra; Last updated: 27/09/2014 by James Gaite}