Structured Text: String conversion to UpperCase


In a function block, that we writed in structured text, we are using the “brsstrcmp” function to compare 2 strings, we need to compare the strings in a “not case sensitive” way, so we thought of converting the strings to UpperCase before comparing them.

Our question is, is there a pre-defined function that we can use to convert a given string to UpperCase (or LowerCase), or has someone written a function that does this conversion?


Hi Martin!

I don’t know any B&R standard library which has function blocks to implement this conversion to upper or lower cases. However our German colleagues has developed great libraries for various functions that are missing in AS.

Inside BrbLib library you have a functions to handle strings to upper or lower cases.

You can take a look to them at: GitHub - br-automation-com/BrbLibs-lib-src: BrbLib (general functions), BrbVc4 (functions for VC4), BrbVc2d (functions for 2d models)

Please keep in mind that the libraries come as is and there is no official support for them.

I hope it helps!!

Hi Martin,

Here’s a short example for changing ASCII strings to uppercase (see attached sample task):

  • check byte for byte of the whole string
  • if the value is between hex 61 and hex 7A, then substract hex 20 (which is the offset between A…Z and a…z in the ASCII table)
  • if not, leave it as it is (1.5 KB)


Thank you very much! This solution works

1 Like