Jump 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.

Where's the extra character space coming from?

Featured Replies

Howdy all:

I'm using this calculation to parse the department from a character string:

 

Let (

db = District_Building__lxt ;

If (

PatternCount ( db ; "Columbus Public - High School" ) or

PatternCount ( db ; "ESU 7" ) or

PatternCount ( db ; "Columbus Public - Kramer" ) ;

Let ( [

len = Length ( db ) ;

lastSpace = Position ( db ; "-" ; len ; -1 )

] ;

Right ( db ; len - lastSpace  )    

     )  

   )

)

 

The calculation works, but curiously it inserts a character space at the beginning of the output of the calculation. How can i filter/calculate it out?

Here are some samples of the text I'm using to parse from:

Columbus Public - High School - Industrial Education

ESU 7 - Learning Academy

Columbus Public - Kramer Education Center

 

 

49 minutes ago, 21st Century Man said:

 Where's the extra character space coming from?

The space character is the character immediately after the last hyphen in the text.

Suppose the text were just: "a - b".
The length of this text is is 5, and the position of the hyphen is 3.
5 - 3 = 2, so your expression:

Right ( db ; len - lastSpace ) 

will return the last two characters of the text, i.e. " b".

 

49 minutes ago, 21st Century Man said:

How can i filter/calculate it out?

It depends. If the hyphen separator is always followed by a space, you might simply subtract it:

Right ( db ; len - lastSpace - 1 ) 

A better solution would look for the position of the entire separator pattern " - " (a hyphen surrounded by spaces) and do:

Let ( [
len = Length ( db ) ;
lastSeparator = Position ( db ; " - " ; len ; -1 )
] ;
Right ( db ; len - lastSeparator - 2  )    
)  

This would allow you to correctly extract "Carter-Brown" from "Smith - Jones - Carter-Brown".
 

If you cannot be sure the space/s will always be there, you may use Trim() on the result (this is assuming the extracted portion will not contain any significant whitespace characters).

 

Create an account or sign in to comment

Important Information

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

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.