×

Subscribe to newsletter

subscribe to our weekly newsletter to get notified with latest story and article Subscribe now!




PLC BLOG | Omron PLC String Instructions - CX-Programmer

Share on Facebook Share On Twitter Share on LinkedIn Share on Whatsapp


Omron PLC String Instructions - CX-Programmer

string is sequence of character it include letters, digits, symbols, and spaces. String declared as a tag with a defined length, which determines the maximum number of characters that can be stored in the string. The Size Can Be Set Between 1 And 255 Characters. In Omron plc strings are enclosed in single quotes to distinguish them from other data types. Example of string value 'message 1’, 'hello'. Strings data type is used to store and manipulate character. In Omron plc you can use PLC String Instructions to compare two character, join two strings, searched for specific patterns, and split into substrings etc.

Omron PLC String Instructions - CX-Programmer

Omron String comparison instructions

String comparison instructions used for comparing two text strings, if the result of the comparison is true, than output is set to true otherwise output is false. String comparison is case sensitive, meaning that 'plc' and 'Plc' are considered different strings.in Omron have following String comparison instructions: such as equal to (=$), <>$, <$, <=$, >$, >=$) , .

Omron String comparison instructions

Omron equal to (=$) String comparison instructions

equal to (=$) used for comparing two strings are equal or not. If both string are equal to each other than output is set true otherwise output is false. Show a example of Omron equal to (=$) String comparison instructions when string_1 and string_2 are equal than output Q:0.00 is set to true otherwise false. For example if string_1 ='plc' and string_2='plc' than output is true if string_1 ='plc' and string_2='blog' than output is false. So always remember string comparison is case sensitive.

Omron equal to String comparison instructions

Omron Not equal to (<>$) String comparison instructions

Not equal to (<>$) String comparison instructions used for comparing two strings are equal or not. if both string are not equal to each other than output is set true otherwise output is false. Show a example of Not equal to (<>$) String comparison instructions when string_1 = 'plc' and string_2 ='blog' both string are not equal than output Q:0.01 is set to true otherwise false.

Omron not equal to String comparison instructions

Omron less than (<$) String comparison instructions

less than (<$) String comparison instructions used for comparing of two strings input character. if first string less than to second string than output is set true otherwise output is false. Show a example of Omron less than (<$) String comparison instructions when string_1='p' and string_2='pl' than output Q:0.02 is set to true otherwise false.

Omron less than String comparison instructions

Omron less than or equal to (<=$) String comparison instructions

less than or equal to (<=$) String comparison instructions used for comparing of two strings input character. if first string less than or equal to second string than output is set true otherwise output is false. Show a example of Omron less than or equal to (<=$) String comparison instructions when string_1='p' and string_2='pl' than output Q:0.03 is set to true otherwise false. if string_1='plc' and string_2='plc' than output Q:0.03 is set to true.

Omron less than or equal to String comparison instructions

Omron greater than String (>$) comparison instructions

greater than (<$) String comparison instructions used for comparing of two strings input character. if first string greater than to second string than output is set true otherwise output is false. show a example of Omron greater than (>$) String comparison instructions when string_1='plc' and string_2='pl' than output Q:0.04 is set to true otherwise false.

Omron greater than String comparison instructions

Omron greater than or equal to (>=$) String comparison instructions

greater than or equal to (>=$) String comparison instructions used for comparing of two strings input character. If first string greater than or equal to second string than output is set true otherwise output is false. Show a example of Omron greater than or equal to (>=$) String comparison instructions when string_1='plc' and string_2='pl' than output Q:0.05 is set to true otherwise false. If string_1='plc' and string_2='plc' than output Q:0.05 is set to true.

Omron greater than or equal to String comparison instructions

Omron CLEAR STRING (CLR$) instructions

Omron CLEAR STRING (CLR$) instructions is used for clear string text from tag. Below is simple example of Omron CLEAR STRING (CLR$) instructions when input of clear string is set to true than string_1 string is cleared. Show a both condition of this instructions.

Omron CLEAR STRING instructions

Omron DELETE STRING (DEL$) instructions

Omron DELETE STRING (DEL$) instructions is used to delete letter of string from specific position and specific character number. It have structure
  • 1. Data type is string, this is actual string in which we perform delete operation.
  • 2. How many character do you want to remove from actual string.
  • 3. Specified position of string
  • 4. Resulted string store in this operand.
considered a simple example of Omron DELETE STRING instructions so we have string tag string_1='plc blog', number of character=2 and beginning position = 5 so resulted string string_out='plc og'. Similarly if string_1='plc blog' and number of character to delete is equal to 3 from position 6 than we get result 'plc b'.

Omron DELETE STRING instructions

Omron INSERT STRING (INS$) instructions

Omron INSERT STRING (INS$) instructions is used to insert a letter of string from specific position and specific character number. Without replacing previous string text or character it have structure
  • 1. Data type is string, this is actual string in which we perform insert operation.
  • 2. Character which you want to insert from actual string.
  • 3. Specified position of string where character is to insert
  • 4. Resulted string store in this operand.
considered a simple example of Omron INSERT STRING instructions so we have string string_1='plc blog', we want to insert 'omron' in position = 4 so resulted string string_out='plcomronbloog'.

Omron INSERT STRING instructions

Omron Find STRING (Find$) instructions

Omron Find STRING (Find$) instructions is used to find a word or single alphabet from specific string and return position of find string. below is simple example of Omron Find STRING instructions when we find alphabet g from string_1 than output of find instructions is 8, similarly if try to find b from string_1 than output 5 if we find l from string_1 so it have two l in different position so it shows first l position from string.

Omron Find STRING instructions

Omron Replace STRING (RPLC$) instructions

Omron Replace STRING (RPLC$) instructions is used to replace a word, single alphabet or string from specific string in specific position and specific character number. INSERT STRING (INS$) instructions used when a new character or alphabet required to insert without removing previous string while Replace STRING (RPLC$) instructions replace specific text, alphabet. It have structure
  • 1. Data type is string, this is actual string in which we perform insert operation.
  • 2. Character which you want to replace from actual string.
  • 3. Specified position of string where character is to replace
  • 4. Resulted string store in this operand.
below is a simple example of Replace STRING (RPLC$) instructions in this example string_1 = 'plc_blog', string 'plc' replace with 'omron'.

Omron Replace STRING instructions

Omron STRING LENGTH (LEN$) instructions

Omron STRING LENGTH (LEN$) instructions is used to calculate the length of string. Below is the simple example of Omron STRING LENGTH (LEN$) instructions. If we have string 'hello world' than output is 11.

Omron STRING LENGTH instructions

Omron STRING Move (MOV$) instructions

Omron STRING Move (MOV$) instructions is used to move string to other location. Below is the simple example of Omron STRING Move (MOV$) instructions. In this example string_1 transfer to new location.

Omron STRING Move instructions

Omron EXCHANGE STRING (XCHG$) instructions

Omron EXCHANGE STRING (XCHG$) instructions is used to replace complete text string with another text string. Replace STRING (RPLC$) instructions only replace specific character at specific location while EXCHANGE STRING (XCHG$) instructions replace complete text string with new one. Example of EXCHANGE STRING (XCHG$) instructions. in this example string_1 replace with string_2 when input is true.

Omron EXCHANGE STRING instructions

Omron GET STRING LEFT (LEFT$) instructions

Omron GET STRING LEFT (LEFT$) instructions is used to Fetches a designated number of characters from the left (beginning) of a text string. as shown in example of Omron GET STRING LEFT (LEFT$) instructions

Omron GET STRING LEFT instructions

Omron GET STRING RIGHT (RIGHT$) instructions

Omron GET STRING RIGHT (RIGHT$) instructions is used to Fetches a designated number of characters from the right (end) of a text string. as shown in example of Omron GET STRING RIGHT (RIGHT$) instructions

Omron GET STRING RIGHT instructions

Omron GET STRING MIDDLE (MID$) instructions

Omron GET STRING MIDDLE (MID$) instructions is used to Reads a designated number of characters from any position in the middle of a text string.as shown in example of Omron GET STRING MIDDLE (MID$) instructions

Omron GET STRING MIDDLE instructions
 
Share on Facebook Share On Twitter Share on LinkedIn Share on Whatsapp


Suggested Post


 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

comment