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.

Removing text after the last /

Featured Replies

I would like to simply remove all of the text from after the last /. The number of / would vary so I would first need to count them. Any slick way to do this?

 

/Volumes/mediaProjects4/tntt_71560_murder/forWebReview/Ep_207_Topical_V1.mov

 

remove all of the text from after the last /

Try

Left ( yourText ; Position ( yourText ; "/" ; Length ( yourText ) ; -1 ) )

Edited by eos

  • Author

That did the trick. Thanks a lot. Here is a follow up question if you don't mind. Is there a way to examine the string for a repeat text after the last slash and remove it. It is bug with my applescript that I can not solve, so thought there may be a way to do it in FM.

 

/Volumes/mediaprojects1/job/Audio/Audio     would become    /Volumes/mediaprojects1/job/Audio

How about:

Let ( [
values = Substitute ( text ; "/" ; ¶ ) ;
n = ValueCount ( values )
] ;
Case ( 
Exact ( GetValue ( values ; n ) ; GetValue ( values ; n - 1 ) ) ; 
Left ( text ; Position ( text ; "/" ; Length ( text ) ; -1 ) - 1 ) ;
text
)
)

Or, if you prefer:

Let ( [
values = Substitute ( text ; "/" ; ¶ ) ;
n = ValueCount ( values ) ;
lastValue = GetValue ( values ; n )
] ;
Case ( 
Exact ( lastValue ; GetValue ( values ; n - 1 ) ) ; 
Left ( text ; Length ( text ) - Length ( lastValue ) - 1 )  ;
text
)
)

 

Edited by comment

How's this:

Let([

a = "/Volumes/mediaprojects1/job/Audio/Audio";
b = PatternCount(a, "/");
c = Position ( a ; "/" ; 1 ; b-1 );
d = Position ( a ; "/" ; 1 ; b )
];

Left(a, c) & Middle(a, d+1, 10000)

)

Edited by dwdata

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.