ddinisco Posted July 9, 2015 Posted July 9, 2015 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
eos Posted July 9, 2015 Posted July 9, 2015 (edited) remove all of the text from after the last / Try Left ( yourText ; Position ( yourText ; "/" ; Length ( yourText ) ; -1 ) ) Edited July 9, 2015 by eos
ddinisco Posted July 10, 2015 Author Posted July 10, 2015 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
comment Posted July 10, 2015 Posted July 10, 2015 (edited) 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 July 10, 2015 by comment
dwdata Posted July 10, 2015 Posted July 10, 2015 (edited) 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 July 10, 2015 by dwdata
Recommended Posts
This topic is 3481 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 accountSign in
Already have an account? Sign in here.
Sign In Now