Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

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

 

Posted (edited)

remove all of the text from after the last /

Try

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

Edited by eos
Posted

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

Posted (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 by comment
Posted (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 by dwdata

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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