With a custom keyboard I use the following code to delete (Del key). This is in a simple EditText control.
It works all fine, except when there are high range (I think above 65536) unicode characters, eg 127754, showing a wave image.
In that case the above code doesn't clear the whole character and there is the well known solid question mark left. Doing a second
Del key press with clear this question mark, but I would like the above to recognize that 2 delete actions are needed to clear the character
but I can't figure out how to recognize this situation. The Asc function doesn't work as the char to use it on doesn't hold the full Unicode character.
Any suggestion how to tackle this problem?
RBS
B4X:
Sub Delete(strOld As String, iIndexStart As Int, iIndexEnd As Int) As String
Dim strPre As String
Dim strSuf As String
If iIndexStart = iIndexEnd Then
If iIndexStart > 0 Then
strPre = strOld.SubString2(0, iIndexStart - 1)
Else
Return strOld
End If
Else
strPre = strOld.SubString2(0, iIndexStart)
End If
If iIndexStart < strOld.Length Then
strSuf = strOld.SubString(iIndexEnd)
End If
Return strPre & strSuf
End Sub
It works all fine, except when there are high range (I think above 65536) unicode characters, eg 127754, showing a wave image.
In that case the above code doesn't clear the whole character and there is the well known solid question mark left. Doing a second
Del key press with clear this question mark, but I would like the above to recognize that 2 delete actions are needed to clear the character
but I can't figure out how to recognize this situation. The Asc function doesn't work as the char to use it on doesn't hold the full Unicode character.
Any suggestion how to tackle this problem?
RBS