×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Xojo
Posted by: Radium Kymist
Added: Feb 7, 2015 12:58 PM
Views: 19
Tags: filter
by simulanics

txtAmountDue.text=txtAmountDue.text.Filter("1234567890.+-")

Would only allow 0-9 and . + - as an input.
  1. Function Filter(Source as string, Allowable as string) As String
  2.   dim i as integer
  3.   dim result as string
  4.   for i = 1 to len(Source)
  5.     if InStr(Allowable, source.Mid(i, 1)) >0 then
  6.       result = result + source.Mid(i, 1)
  7.     end if
  8.   next
  9.  
  10.   return result
  11. End Function