Android Question looking for a neater method

Mark.S

Member
Licensed User
Simple problem, need to ensure only two decimal can be input.
this code works but its ugly!


B4X:
DecPoint = KeyboardInput(17).Text.IndexOf(".")
If DecPoint <1 Then  'No decimal point
KeyboardInput(17).Text=KeyboardInput(17).Text & KeyPress '  ***   Add Char to string   ***
                        Else
                            If KeyboardInput(17).Text.Length - DecPoint <3 Then
                                KeyboardInput(17).Text=KeyboardInput(17).Text & KeyPress '  ***   Add Char to string   ***
                            End If       
                    End If
 
Top