350 views
in Getting started by
Hello,

 

I'm devoloping a program in witch I receive a number and I need to associate this number with a string. The problem is the enormous quantity of numbers and strings that i need to associate.

 

Example:

I receive the number 520000 and 520001

I have already define a string with the name "xpto1" and another one with xpto2 (With 4 different languages)

The number 520000 is associated with the string xpto1 and the number 520001 is associated with the string xpto2.

 

 

Is there any way, efficient, where I can define the index in the string xpto1 equivelent to the number 520000 and xpto2 to 5200001?

 

Thank You.

 

Best Regards

RickyVasco

1 Answer

+1 vote
by

Hi,

a language feature supporting such kind of mapping is not available. I would use the switch-case statement to select depending on the provided number one of the available strings. If the string is stored in a localized, multilingual constant, the implementation will automatically provide the right language version for the string. Such switch-case mapping could look like this:

var string theString = "";

switch ( theID )
{
  case 520000 : theString = YourUnit::xpto1;
  case 520001 : theString = YourUnit::xpto2;
  ...
}

Best regards

Paul Banach

by
Hello,

Thank you so much for the help, Paul.

I will implement it that way.

Best Regards

RickyVasco

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

...