Jump to content

Problem with procedural naming expresion


macj89

Recommended Posts

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!

Link to comment
Share on other sites

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)`

  • Thanks 1
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...