String.Decode

Top  Previous  Next

 

Syntax

function String.Decode(Expression: variant; Search: variant; Result: variant; [Search2: variant; Result2: variant...] [; Default : variant]) : variant

 

Alternative Names

ibec_Decode

 

Description

Evaluates the given expression, compares the result of the expression to search values and return the paired result. If the expression evaluates to a value not being searched for, an optional default value can be returned.

 

You can have as many search=result pairs as you like.

 

Returns a value based on the evaluation expression.

 

Example

execute udsblock

as

begin

  /* return 'result2' */

  valuein1 = 'possible2';

  valueout = String.Decode(valuein1, 'possible1', 'result1', 'possible2', 'result2', 'possible3', 'result3');

  GUI.ShowMessage(valueout); 

  

  /* return 'default' */

  valuein1 = 'not available';

  valueout = String.Decode(valuein1, 'possible1', 'result1', 'possible2', 'result2', 'possible3', 'result3', 'default');

  GUI.ShowMessage(valueout); 

  

  /* return NULL, as the value is not found and there's no default */

  valuein1 = 'not available';

  valueout = String.Decode('nope', 'possible1', 'result1', 'input 1', 'result2', 'nothing', 'result3');

  if valueout = null

  then GUI.ShowMessage('null'); 

  else GUI.ShowMessage(valueout);

end