Hello,
I use WinCC-OA 3.16P11.
Is it possible to read a single character from an uni-string. Adressing characters with [index] seems to work byte-wise only.
For example reading the 3. character ("ö") from string "aböcd" does not work with string[2]. Also I could not find any uniStr-function that has this functionality.
Use-case is to make a filter-string from the original string that ignores case with patternMatch(), for example the filter string for "aböcd" would be "[aA][bB][öÖ][cC][dD]".
Is there any way to achieve this?
Kind regards
Read single character from uni-string
Search
Re: Read single character from uni-string
Why not ?
From P013 onwards you could also use:
or
But they will always return a string type, obviously. Not sure if that might be a problem for you.
Code: Select all
substr(your_string_var, 2, 1)
From P013 onwards you could also use:
Code: Select all
your_string_var.mid(2, 1);
Code: Select all
your_string_var.at(2);
Re: Read single character from uni-string
Thank you, uniSubStr() works fine. When searching for uni-string functions in the help I searched for "uniStr*" so I did not find it...
Re: Read single character from uni-string
Indeed, sorry, uniSubStr instead of substr. The other two introduced with P013 work on the unicode character level and not on bytes, so they would be good for this as well.
-
- Posts: 373
- Joined: Tue Jan 15, 2019 3:12 pm
Re: Read single character from uni-string
Also the 'strwalk' function should be able to read a single Unicode character.