Strip characters on a match
Posted: Fri May 15, 2015 1:20 am
I need to find an object using a text value from a menu. The problem I have is that the menu labels sometimes contains the AMPERSAND character. My problem is that the menu system no longer underlines the letter from the menu item.
In other words, if the menu item shows the option "Print", the text attribute that I need to look for may me "Print", "&Print", "P&rint", "Pr&int", "Pri&nt" ou "Prin&t", there is no way for me to guess which because the UNDERLINE is no longer visible with my screen interface.
Of course, I could go into the program source code, and examine the actual text, but this is not possible for me.
Right now, the only way that I can match my menu item is with the following RxPath:
menuitem[@text='Print' or @text='&Print' or @text='P&rint' or @text='Pr&int' or @text='Pri&nt' or @text='Prin&t']
Of course I could also use:
menuitem[@text~'&?P&?r&?i&?n&?t']
I wish I could trim the AMPERSAND from the text string before doing a match:
menuitem[replace(@text,'&','')='Print')
Is there another way to match a string containing a specific character in any location?
In other words, if the menu item shows the option "Print", the text attribute that I need to look for may me "Print", "&Print", "P&rint", "Pr&int", "Pri&nt" ou "Prin&t", there is no way for me to guess which because the UNDERLINE is no longer visible with my screen interface.
Of course, I could go into the program source code, and examine the actual text, but this is not possible for me.
Right now, the only way that I can match my menu item is with the following RxPath:
menuitem[@text='Print' or @text='&Print' or @text='P&rint' or @text='Pr&int' or @text='Pri&nt' or @text='Prin&t']
Of course I could also use:
menuitem[@text~'&?P&?r&?i&?n&?t']
I wish I could trim the AMPERSAND from the text string before doing a match:
menuitem[replace(@text,'&','')='Print')
Is there another way to match a string containing a specific character in any location?