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

How to remove a fixed starting characters

Featured Replies

Thanks for all the help. This is a great forums.

When I scan a part number it sometimes come up with 1Pxxxxxxxxx, the rest of characters real part number. The real part number can have 8 - 10 characters.

How can I remove the first 2 characters (1P) if they exixt?

Again Thanks!

Well you can use the left, right, position functions but maybe you should supply us with more information so that we can help you in greater detail.

Is there always 2 characters in the beginning that you want to get rid of? If so is the second character always a Alpha-character? etc etc.

The more detail the better.

  • Author

Here's some examples:

1PP1234LPMM - will need to trim the starting 1P

1PM123456PMM9 - will need to trim the starting 1P

M123456PMM9 - No need to do any trim

P12345 - No need to do any trim

Thanks

Ok...

so how does one determine if something needs to be trimmed or not? You still have not answered my earlier questions. We would need the rule to determine if it needs to be trimmed or not, otherwise how can we know when to trim it or not? Does it need to be trimmed only when it starts with 1P ?

Have you tried?

Substitute(Text, "1P", "")

Should work... unless the character sequence "1P" occurs elsewhere in the string and truly belongs there.

It seems pretty clear that 1P should only be removed if it exists as the first two characters. In which case, Lee, your calc would also remove 1P if it exists later in the string. This should protect from that possibility ...

If (

Left ( PartNumber ; 2 ) = "1P" ;

Substitute ( PartNumber ; Left ( PartNumber ; 2 ) ; "" ) ;

PartNumber )

LaRetta :wink2:

Edited by Guest
Corrected for vs. 7

Darn, I missed that it was for v7, I responded to his profile of v6.

Yes, Ted, I'm aware of that too.

so now, Thanh has a couple of choices.

Lee

Darn is right, Lee. I saw version 6!! Change the commas to semi-colons for vs. 7. :blush2:

Update: I corrected the above calc

Edited by Guest
Added Update

I'm afraid your calc suffers from the same flaw as Lee's:

If (

Left ( PartNumber ; 2 ) = "1P" ;

Substitute ( PartNumber ; Left ( PartNumber ; 2 ) ; "" ) ;

PartNumber )

If the test is true, the substitution part evaluates as:

Substitute ( PartNumber ; "1P ; "" )

Suppose the PartNumber is entered as "1P55AA1P". Your result will be "55AA", instead of "55AA1P".

Try:

Case (

Left ( PartNumber ; 2 ) = "1P" ;

Right ( PartNumber ; Length ( PartNumber ) - 2 ) ;

PartNumber

)

Thank you for catching it. I missed that logic about Substitute(). :blush2: :wink2:

  • Author

Thank You All. I really appreciated.

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.