The following example searches for the first occurrence of a digit in an input string. If a digit is found, it returns its position, otherwise it returns -1. In this case, the input string is set explicitly to a string constant. If preferred, it could be set to be equal to a String type database field instead.
For example, for the input String, "The 7 Dwarves", the formula returns 5, which is the position of the digit 7.
Dim inString inString = "The 7 Dwarves" Dim i, strLen i = 1 strLen = Len (inString) formula = -1 Do While i <= strLen And formula = -1 Dim c As String c = Mid (inString, i, 1) If IsNumeric (c) Then formula = i i = i + 1 Loop
Seagate Software, Inc. http://www.seagatesoftware.com Please send comments to: techpubs@seagatesoftware.com |