array separated by the string ", "?

A developer has created a string array variable as shown below:

UserNames = {"Jane", "Jack", "Jill", "John"}

Which expression should the developer use in a Log Message activity to print the elements of the

array separated by the string ", "?
A . String.Join(UserNames, ",")
B . String.Join(", ", UserNames)
C . String.Concat(UserNames,",")
D . String.Concat(",", UserNames)

Answer: B

Explanation:

The String.Join method takes two parameters: a separator and an array of strings. It returns a new string that concatenates the elements of the array using the separator. The correct syntax is String.Join(separator, array). Therefore, option B is the correct answer.

Reference:

Automation Developer Associate Training course, Section 1: Data Manipulation, Lecture: Data Manipulation with Strings in Studio

How to use Array of string forum post, Answer by @balupad14

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments