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

the middle character of a long number or text string

Featured Replies

Can any body help me with a calculation to extract the middle character/s of a long number or a text string, eg,

the 5th character in the number 12345678

or the 4th letter in stephen

In both of the examples I will not know the contents of the number or text string, they will be different every time.

Steve

Hi

assuming that the middle character of an even lenght string is the last char of the middle count of chars ( and in your first example it must be the 4th);)

Let(

len = Lenght(YourString);

Case(

mod ( len ; 2 ); Div ( len ; 2 )+ 1;

Div ( len ; 2 )

)

this calc can be simplified to:

Let(

len = Length ( YourString );

Div ( len ; 2 ) + Mod ( len ; 2 )

)

  • Author

Thanks for your post but it's not giving me the result I need.

After testing your caculation it returns a 6 for the serial number UV432007QHU, but in this instance I would need the 0 in the middle?

I think your calculation just counts the middle character, but I need to know exactly what it is, eg, 0 in the serial number above.

How about:

Let ( [

len = Length ( string ) ;

mid = Ceiling ( len / 2 )

] ;

Middle ( string ; mid ; 1 )

)

oops...

yes, you can use the comment calc or this one

Let([

len = Length ( YourString );

mid = Div ( len ; 2 ) + Mod ( len ; 2 )

];

middle( YourString ; mid ; 1 )

)

  • Author

Thank you!

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.