Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Checking text

Featured Replies

How would I check a text field to see if the text in it is formated correctly? For example: I have a text field titled Index1. I have a script that puts text into that field. What I need to do is write another script that checks to see if the first letter is a "b" or "w" and the next character is a number. I now about the left function. But how do I test for a non-specific number?

Hi Heath, try script something like:

If [

[color:blue]Let (

[

alpha = PatternCount ( "bw" ; Left ( Index1 ; 1 ) ) ;

num = PatternCount ( "0123456789" ; Middle ( Index1 ; 2 ; 1 ) )

] ;

alpha and num

) ]

... passes test (do whatever)

Else

... fails test (do whatever)

End If

LaRetta :wink2:

I should explain ... I should have used Position() instead of PatternCount() because it is more [color:blue]efficient

Position() returns true (thus short-circuits) when the first pattern match is found; PatternCount() must continue through the entire text-string to count all pattern matches.

I used PatternCount() here because it would make the calculation look shorter : and I didn't think it would make much difference here. But in this business EVERY nanosecond counts and if one used the first calc in large text-string, the difference could be significant. So this calc is better than the prior (and I would use this one):

Let (

[

alpha = Position ( "bw" ; Left ( text ; 1 ) ; 1 ; 1 ) ;

num = Position ( "0123456789" ; Middle ( text ; 2 ; 1 ) ; 1 ; 1 )

] ;

alpha and num

)

But I would defect (to a different calc) in a heartbeat if it's better than this one, also!! :wink2:

LaRetta

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.