Markup TextBox Ottieni testo normaleQualcuno conosce un modo per ottenere il testo normale di una TextBox a cui è stato applicato del markup? Ad esempio, nell'esempio seguente vorrei ottenere il testo "Questo è testo in grassetto. Questo è testo in corsivo. Questo è testo sottolineato. Questo è testo in grassetto, corsivo e sottolineato." dalla casella (senza le direttive di markup).
Ho un sistema che crea registri nella parte inferiore di alcune app che supportano il markup (principalmente per i caratteri in grassetto e rosso), ma vorrei poter salvare occasionalmente il registro in un file senza che contenga le direttive di markup.
Grazie!
Names Default To Here( 1 );
win = New Window( "Example", fontobj = text = Text Box( "Example Text" ) );
text << setText(
"This is <B>bold</B> text. This is <I>italic</I> text. This is <U>underlined</U> text. This is <B><I><U>bold, italic, underlined</U></I></B> text."
);
text << markup;
Ingegneria della qualità e dei processiRe: Markup TextBox Ottieni testo normaleMi viene in mente solo una sorta di Regex, ma il modello potrebbe diventare fastidioso da costruire
Names Default To Here( 1 );
win = New Window( "Example", fontobj = text = Text Box( "Example Text" ) );
text << setText(
"This is <B>bold</B> text. This is <I>italic</I> text. This is <U>underlined</U> text.
This is <B><I><U>bold, italic, underlined</U></I></B> text.
Text using a <FONT face="Vivaldi">different</FONT> font face.
Text using a <FONT size="16">different</FONT> font size.
This is <FONT color="Blue">blue</FONT> text. This is a <BACKGROUND color="yellow">yellow</BACKGROUND> background. This is <FONT color="#0000ff"><BACKGROUND color="0xffff00">blue text on a yellow background</BACKGROUND></FONT>."
);
text << markup;
Regex(text << get text, "()", "", GLOBALREPLACE);
Re: Markup TextBox Ottieni testo normaleIdea fantastica!Non mi era venuto in mente di usare regex, ma è piuttosto fluido.