Ciao ragazzi, ho riscontrato un problema con il ReplaceAll, in pratica ho fatto un semplice test, finestra con due textarea, un checkbox e un bottone con questo codice nell’evento Action
Dim messaggio As String = TextArea1.Text
If CheckBox1.Value Then
messaggio = messaggio.ReplaceAll("", "1")
messaggio = messaggio.ReplaceAll("", "2")
Else
messaggio = messaggio.ReplaceAll("", "2")
messaggio = messaggio.ReplaceAll("", "1")
End If
TextArea2.Text = messaggio
se nella text area metto il testo “fsfsdffsdf”, all’alternanza del checkbox ottendo la sostituzione sia con 1 che con 2… e non mi sembra corretto.
Ora magari il caldo mi ha fuso il cervello e ho la soluzione sotto gli occhi e non la vedo, ma a me pare un bug, che ne dite?
PS: se volete l’esempio eccolo qua!
Nessun problema
Le funzioni stringa non sono case sensitive
quando la casella NON selezionata, viene eseguito il codice ELSE e il simbolo (maiuscolo e minuscolo) viene sostituito con un 2
quando la casella di controllo spuntata, il codice THEN viene eseguito e il simbolo (maiuscolo e minuscolo) viene sostituito con un 1
Thanks Norman, think ill have to find a workaround for this
unfortunately replaceall, and all other string functions like it, don’t have a “case sensitive” option like StrComp does
about the only way I can think of is to search it as raw bytes and then you’ll get an exact match on the same byte sequences
BUT you have other issues depending on whether the E is composed or not since it can be a single unicode character, or represented as two or more bytes in various forms - a combining ’ mark and E and … blech …
[quote=443162:@Norman Palardy]http://documentation.xojo.com/api/deprecated/text.html#text-replaceAll
it DOES have the option to use case sensitive or not[/quote]
Oh, thanks a lot! Will do a test.