Jump to content

the middle character of a long number or text string


This topic is 5802 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

Link to comment
Share on other sites

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 )

)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This topic is 5802 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

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