macj89 Posted February 19, 2019 Share Posted February 19, 2019 Hello! I am trying to isolate one part of my HIPNAME in order to make a "version folder" when rendering. So the hip name look like this: AAA_BBBBBB_cccccccc_v001_ddd i want to isolate the v001. I am trying this: `substr($HIPNAME, 20, 24)` and instead of giving me v001 it gives me v001_ddd I guess is something conflicting with the underscore. Any other way to isolate it? Thanks! Quote Link to comment Share on other sites More sharing options...
fencer Posted February 19, 2019 Share Posted February 19, 2019 17 minutes ago, macj89 said: Hello! I am trying to isolate one part of my HIPNAME in order to make a "version folder" when rendering. So the hip name look like this: AAA_BBBBBB_cccccccc_v001_ddd i want to isolate the v001. I am trying this: `substr($HIPNAME, 20, 24)` and instead of giving me v001 it gives me v001_ddd I guess is something conflicting with the underscore. Any other way to isolate it? Thanks! substr - Returns the characters of s between the start position and the start + length position. 20+4 `substr($HIPNAME, 20, 4)` 1 Quote Link to comment Share on other sites More sharing options...
macj89 Posted February 19, 2019 Author Share Posted February 19, 2019 Yeah, im stupid, i just read again the documentation. Anyways, at the end looks that 21, 4 solves it Thanks! haha Quote Link to comment Share on other sites More sharing options...
macj89 Posted February 19, 2019 Author Share Posted February 19, 2019 Found a better way. Since the " c " string is never locked on character number, i needed something more procedural, so here it is: `substr($HIPNAME, (strlen($HIPNAME)-8) ,4)` This calculates the number of letters that HIPNAME has, substracts 8 ( v001_ddd = 8 characters) to set the starting point and then the 4 is the 4 characters of v001. I feel like a real hackerman now. Thanks for the motivation haha Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.