Anytime. And if we meet, a decent Rum will suit just fine ☺ On 5/07/2014 10:05 PM, "haseeb ahmed" <[email protected]> wrote:
> wow, its amazing. thank you sir, its perfect. i owe you a drink . > regards,lala > > > On Sat, Jul 5, 2014 at 1:00 PM, Justin Israel <[email protected]> > wrote: > >> Oh ok. You didn't actually have the charName value and you just want to >> remove the last component separated by an underscore. >> I don't really see the reason to try and first parse the token out of the >> string, and then use it to remove it from the original. You can just use a >> regex to strip it: >> >> >> string $srcFile = "blabla_blabla_charName.fbx"; >> string $saveFileString = basename( $srcFile, ".fbx" >> ); >> string $saveFileName = `substitute "_[a-zA-Z0-9]+$" $saveFileString ""`; >> >> >> Or you can completely avoid regular expression and just split the string >> on underscore, and join it back without the last component: >> >> string $srcFile = "blabla_blabla_charName.fbx"; >> string $tokens[];int $size = tokenize($srcFile, "_", $tokens); >> stringArrayRemoveAtIndex($size-1, $tokens); >> string $saveFileName = stringArrayToString($tokens, "_"); >> >> >> >> >> >> On Sat, Jul 5, 2014 at 7:16 PM, lala <[email protected]> wrote: >> >>> string $srcFile = "blabla_blabla_charName.fbx"; >>> string $saveFileString = basename( $srcFile, ".fbx" ); >>> string $charName = "_" + `substitute "^[^.]*\\_" $saveFileString ""`; >>> string $saveFileName = `substitute $charName $saveFileString ""`; >>> print $saveFileName; >>> >>> apparently its solved now with your help. but if you look at line 3, its >>> cheap (adding "underscore manually"). but atleast its working. >>> generally, i am sure, regex in line 3 again (second part) can solve >>> it..but still, thanks anyways, really appriciate your prompt responses. >>> always. thats only reason, posting here is more fun than anywhere else. >>> >>> On Saturday, 5 July 2014 11:55:36 UTC+5, Justin Israel wrote: >>> >>>> That's what you wanted right? >>>> >>>>> options, visit https://groups.google.com/d/optout. >>>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Python Programming for Autodesk Maya" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/python_inside_maya/a200980e-cd6a-4c72-bd26-c3954639cd3e%40googlegroups.com >>> <https://groups.google.com/d/msgid/python_inside_maya/a200980e-cd6a-4c72-bd26-c3954639cd3e%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "Python Programming for Autodesk Maya" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/python_inside_maya/tTDvkKKRX0w/unsubscribe >> . >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1fq6A7%2Bc5UoJ7YddPkQO1TC97ETLA1R%2BhiQgzX%3DOL6CA%40mail.gmail.com >> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1fq6A7%2Bc5UoJ7YddPkQO1TC97ETLA1R%2BhiQgzX%3DOL6CA%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > regards, > lala > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/CABM86kDwBDezXfoEnZvNCtUsYZMg%2BRqf%3D8JRtVFup9rKNxgS3A%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CABM86kDwBDezXfoEnZvNCtUsYZMg%2BRqf%3D8JRtVFup9rKNxgS3A%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2Rf4yAOWQHKrOSuefDRv0GFqFGU4Yw4GHSWYv49Gfq7w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
