Deleting the beginning characters of a string

   4836   3   1
User Avatar
Member
3 posts
Joined: Feb. 2017
Offline
Hello,

In this thread [www.sidefx.com], I learned how to remove the end characters of a string using VEX.


How would I go about deleting the beginning characters of a string?

I have a KineFX rig in my scene and, as an example, I want to rename the name attribute of my joints from this:

ManSkeleton_Complete:Joint_1
ManSkeleton_Complete:Joint_2
ManSkeleton_Complete:Joint_3

to this:

Joint_1
Joint_2
Joint_3


Any help would be appreciated.

Thanks!
User Avatar
Staff
3455 posts
Joined: July 2005
Offline
you could try split()
https://www.sidefx.com/docs/houdini/vex/functions/split.html [www.sidefx.com]

and use the string ":" as the separator
Michael Goldfarb | www.odforce.net
Training Lead
SideFX
www.sidefx.com
User Avatar
Member
2 posts
Joined: Aug. 2019
Offline
goldfarb
you could try split()
https://www.sidefx.com/docs/houdini/vex/functions/split.html [www.sidefx.com]

and use the string ":" as the separator

Hey thanks Mike, that worked great. I have exactly the same issue as Nico. The characters are coming from Maya with a namespace at the front of every joint. I need to remove that namespace so the constraints and hand controls work.

This is the code in an attribWrangle that worked for me (got the idea for the code from: https://vimeo.com/193825912):
string parts[] = split(s@name, ":");
s@name = parts[-1];

Now the problem is that I can't get all my edited animation back onto the character using the bone deform. Removing the namespace is creating a difference somewhere that stops the animation... If I figure it out, I'll post here.
Edited by simt - Feb. 24, 2022 06:36:37
User Avatar
Member
7638 posts
Joined: July 2005
Online
You could also just use the Attribute String Edit SOP:
- Enable Detail for good measure
- Editor > From = ManSkeleton_Complete:*
- Editor > To = *
Edited by edward - Oct. 3, 2023 10:40:48
  • Quick Links