P
Pascal
How to store all the words of a text in a table, modify some of them, then
reconstruct the text by retaining the original punctuation?
I tried this:
words = TextBox1.Text.Split(New String() {" "c, ","c, "."c, ":"c,
";"c, "?"c, "!"c, "'"c, "`"c, "-"c}, StringSplitOptions.RemoveEmptyEntries)
then :
Dim WordsSpan = words.Clone
Dim word As String
For Each word In words
word = ("<span class=""blue"" onclick=""verif(this)"">" + word +
"</span>")
TextBox2.Text += word
Next
so the text
" Les poules du couvent couvent l'obscurité la nuit.
Pourquoi? moi, eux-mêmes!
radis noirs: sérieux"
becomes:
<span class="blue" onclick="verif(this)">Les</span><span class="blue"
onclick="verif(this)">poules</span><span class="blue"
onclick="verif(this)">du</span><span class="blue"
onclick="verif(this)">couvent</span><span class="blue"
onclick="verif(this)">couvent</span><span class="blue"
onclick="verif(this)">l</span><span class="blue"
onclick="verif(this)">obscurité</span><span class="blue"
onclick="verif(this)">la</span><span class="blue"
onclick="verif(this)">nuit</span><span class="blue" onclick="verif(this)">
Pourquoi</span><span class="blue" onclick="verif(this)">moi</span><span
class="blue" onclick="verif(this)">eux</span><span class="blue"
onclick="verif(this)">mêmes</span><span class="blue" onclick="verif(this)">
radis</span><span class="blue" onclick="verif(this)">noirs</span><span
class="blue" onclick="verif(this)">sérieux</span>
where all the ponctuation disappears!
any idea please
thanks
reconstruct the text by retaining the original punctuation?
I tried this:
words = TextBox1.Text.Split(New String() {" "c, ","c, "."c, ":"c,
";"c, "?"c, "!"c, "'"c, "`"c, "-"c}, StringSplitOptions.RemoveEmptyEntries)
then :
Dim WordsSpan = words.Clone
Dim word As String
For Each word In words
word = ("<span class=""blue"" onclick=""verif(this)"">" + word +
"</span>")
TextBox2.Text += word
Next
so the text
" Les poules du couvent couvent l'obscurité la nuit.
Pourquoi? moi, eux-mêmes!
radis noirs: sérieux"
becomes:
<span class="blue" onclick="verif(this)">Les</span><span class="blue"
onclick="verif(this)">poules</span><span class="blue"
onclick="verif(this)">du</span><span class="blue"
onclick="verif(this)">couvent</span><span class="blue"
onclick="verif(this)">couvent</span><span class="blue"
onclick="verif(this)">l</span><span class="blue"
onclick="verif(this)">obscurité</span><span class="blue"
onclick="verif(this)">la</span><span class="blue"
onclick="verif(this)">nuit</span><span class="blue" onclick="verif(this)">
Pourquoi</span><span class="blue" onclick="verif(this)">moi</span><span
class="blue" onclick="verif(this)">eux</span><span class="blue"
onclick="verif(this)">mêmes</span><span class="blue" onclick="verif(this)">
radis</span><span class="blue" onclick="verif(this)">noirs</span><span
class="blue" onclick="verif(this)">sérieux</span>
where all the ponctuation disappears!
any idea please
thanks