|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > JXX. - Jump - Instructions > JIC. - Jump If Contains |
MiniRobotLanguage (MRL)
JIC. Jump if Contains
Jump If String contains P2
Intention
This command can be used to test a string-variable contains another string.
This command is case sensitive.
Or it can be used to check if a string does not contain the given string when using the ! Operator.
There is no negative Command of this Jump, as you can use the ! Operator for that.
Internally this works like IVC. just it has not the "b" and e" options.
The easiest usage is like this:
$$TXT=Hallo Peter
JIC.$$TXT=Peter|Label
In this Mode, JIC. will jump to the Label, if the given string "Peter" is contained in $$TXT.
Alternatively you can do the opposite:
' Test if the String in $$TXB is not contained in $$TXA
JIC.$$TXA!$$TXB|Label
Assume that you want to know if a text contains ANY of a list of special characters.
Going from here you would need to check for each single character.
But help is here! You can use the < (ANY OF) Operator.
VAR.$$NAM=Rolf Müller
JIC.$$NAM<üäö|Label
But do not intermix it with the > "ONLY ANY OF" Operator.
This one will make sure that the given string contains ONLY characters that are are contained in the text/string given.
VAR.$$NAM=Rolfi
JIC.$$NAM>folR|Label
P1 must be a variable.
P2 must be any of the following 4 Operators.
>,<,=,!
Operators:
0 - contains
! - NOT CONTAINED
< - ANY OF
> - ONLY ANY OF
JIC. can be used as a conditional JSR. (Gosub like) if using ":" as a prefix to the Label).
In normal Mode JIS. will always just make a JMP. (Goto like).
Hint: If you think that the evaluation is not correct, use
PRT.$$VAR|h
MBX.!
to check for invisible characters and Spaces. You will get a ASC-Dump like this, which shows all characters inside the variable with their Hex-ASC-Code.:

Syntax
JIC.P1=P3|Label
JIC.P1!P3|:Label
JIC.P1P2P3|Label
JIC.P1P2P3|:Label
Parameter Explanation
P1 - must be a variable with a text string
P2 - condition sign: >,<,=,!
Use only one condition sign.
P3 - variable or Text
Will leave the position of the found string on the TOS.
Example
'*************************************
' Simple JIS - Example
'*************************************
$$TXT=Hallo Peter
' test if String is empty or not
JIC.$$TXT=Peter|Label
MBX.Is not contained
END.
:Label
MBX.Is caintained.
END.
Remarks
The available condition signs are: >,<,=,!
Use only one of these condition signs.
You can not combine condition signs like ">=" or "<>" etc.
Limitations:
-
See also:
• JME. - Jump on More or Equal
• JLE. - Jump on Less or Equal
• JSR. - Jump SubRoutine (Label)