I have some problems with testing if the input word contains a letter .
The code below adds words to a list upon a letter identification criteria like this :
I promt user: Enter a word with the letter c
Test if the new input word contains letter c and save the word else prompt error.
I have a list of letter saved in a file named listac formatted UTF-8 that contains letters :B,C,D,F,G,H,J,L,M,N,P,R,S,Ş,T,Ţ,V,Z
file here: https://www.dropbox.com/s/pdbxanfzu1unq9r/listac.txt
I use format UTF-8 to be able to display diacritics like Ş Ţ,
Question or problem: The code works great for all letters except B !
What is with this letter that the code does not accept it ? or with me .
In log after entering B it shows correctly but the loop condition does not see that the letter is actuall B
and displays the message box please enter word with letter B
If I use format ANSI then the letter B works as well but I can not display Ş Ţ so it does not help me much
B JUST BEAT ME THIS TIME .
Thanks for helping
The code below adds words to a list upon a letter identification criteria like this :
I promt user: Enter a word with the letter c
Test if the new input word contains letter c and save the word else prompt error.
I have a list of letter saved in a file named listac formatted UTF-8 that contains letters :B,C,D,F,G,H,J,L,M,N,P,R,S,Ş,T,Ţ,V,Z
file here: https://www.dropbox.com/s/pdbxanfzu1unq9r/listac.txt
I use format UTF-8 to be able to display diacritics like Ş Ţ,
Question or problem: The code works great for all letters except B !
What is with this letter that the code does not accept it ? or with me .
In log after entering B it shows correctly but the loop condition does not see that the letter is actuall B
and displays the message box please enter word with letter B
If I use format ANSI then the letter B works as well but I can not display Ş Ţ so it does not help me much
B JUST BEAT ME THIS TIME .
Thanks for helping
B4X:
Sub alit_click
Dim alit As Button
alit=Sender
Dim row As Int
row=alit.tag
grow=row
'If row<>0 Then
Dim position As Int
position=row
Dim value As String
value=tokenlist.Get(row)
sincronizare(position ,value)
Dim xtoc As String
xtoc=listaclist.Get(row)
Dim newlit As EditText
newlit.Initialize("")
add.AddView(newlit,10dip,10dip,320dip,50dip)
add.Show("New word with letter: "&xtoc,"Save","Cancel","",Null) 'CUSTOM DIALOG SHOW
If add.Response=-1 Then
Log("newlit.text"&newlit.Text.ToUpperCase)
If newlit.Text.ToUpperCase.Contains(xtoc) Then
lista.add(newlit.Text.ToUpperCase) 'saves the new word to current list
save_word(position) 'save routine like: File.WriteList(File.DirDefaultExternal,"b.txt",lista)
afisare_lit ' shows words list in scrolview
ToastMessageShow("New letter added ! "&newlit.Text,True)
Else
Msgbox("Letter must contain: "&xtoc,"Notification")
End If
End If
'Else
'Msgbox("This lettter is not availlable ,please try another one",Null)
'
'End If
End Sub
Last edited: