703 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 - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...