join()

join() concatenates all the elements of an array into a string. This method accepts one parameter which is any symbol to be inserted between the values of the elements in the array.

Syntax:

arr.join()

arr.join("|")

Usage example:

arr.join()

FUNCTION join_array_0_param()
	DEFINE arr DYNAMIC ARRAY OF INTEGER
	DEFINE joined_value STRING
	LET arr[1] = 10
	LET arr[2] = 20
	LET arr[3] = 30
	LET arr[4] = 40
	LET joined_value = arr.join()
	DISPLAY joined_value
END FUNCTION

arr.join("|")

FUNCTION join_array_1_param()
	DEFINE arr DYNAMIC ARRAY OF INTEGER
	DEFINE joined_value STRING
	LET arr[1] = 10
	LET arr[2] = 20
	LET arr[3] = 30
	LET arr[4] = 40
	LET joined_value = arr.join("|")
	DISPLAY joined_value
END FUNCTION

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.