Database Solutions - Hints & Tips

Tip 15:
Finding the Position of the First Digit

It is sometimes required to find the position of the first digit or a character in a string or contents of a field. This can be elegantly obtained:

scan field1, ‘#’ ; $result will have the position of the first digit

E.g. if field1 contains ‘London EC1 2SZ’

scan field1, ‘#’ ; $result = 10

Similarly,

scan field2, ‘&’ ; $result will have the position of the first character

E.g. if field2 contains 10th anniversary

scan field2, ‘&’ ; $result =3

compuware_01.gif (3977 bytes)


Copyright ©2000 OCS Consulting plc

dbs_block_logo.gif (2150 bytes)
Refresh Frames