610 views
in GUI Development by
Hello EmWi community,

is there a way to convert a character array to a string variable inside the EmWi-IDE?

1 Answer

0 votes
by

Hello,

create a string with a length corresponding to the number of characters within the array and then loop through the array elements and assign the characters one by one to the string. The following is the code:

// The array containing the characters to compose the string
// and the number of characters to pick from the array.
array char theArray[...];
var int32  noOfChars = ...;

// Create a new string with length matching exactly the number
// characters you want to copy from the array
var string theString = string( ' ', noOfChars );
var int32  i;

// Loop through the array and copy the characters into the 
// string
for ( i = 0; i < noOfChars; i = i + 1 )
  theString[i] = theArray[i];

Hope it helps you further.

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...