Notifications
Clear all

[Closed] String and some character of string

Hi everybody
is it possible to get some ending characters of a string ?
for example
A=“c:/001/fooolder”
B=“c:/001/character/0033”

i need to get all characters of A and B after the last /
i mean for A “fooolder”
and
for B “0033”

any help is appreciated

5 Replies

Hi,

look for filterstring in the mxs help …


A="c:/001/fooolder"
Arr=filterstring A "/"
last = arr[arr.count]

Thanks so much for quick reply

Thanks

It makes sense to use built-in functions when working with paths, i.e. filenameFromPath / pathConfig.stripPathToLeaf.

Thanks for the reply
As far as i know Max works both “\” and “//” ‘filenameFromPath” is a relief for this questions.
Because in such a case

AA="c:\\001\\002/033"
   last2=filenameFromPath AA	--it turns "033"
   
   ---but in filtering way
   
   Arr=filterstring AA "\\"	--#("c:", "001", "002/033")
   last = arr[arr.count]	--"002/033"	
   Br=filterstring last "/"	--#("002", "033")
   Last2=Br[Br.count]	--"033"	

Zbuffer thanks for the reply because i learnt first i have to learn maxscript and then i have to learn how to use it.

Thanks Zbuffer and Swordslayer and Merry Christmas to you both and All

i hope you gave a nice present to ScriptLove

btw. pathConfig.stripPathToLeaf should be used in your case as Swordslayer suggested…