> [!abstract] Summary > **Strip the last underscore-separated token from `@path`** — typical use is removing a trailing version number or suffix from a USD prim path (e.g. `myAsset_geo_v003` → `myAsset_geo`). Uses `split` + `join` (`join` is the inverse of `split`). --- # The Snippet **Attribute Wrangle** — Run Over: **Primitives**. ```c // Split @path on "_", then re-join all but the last token. // Example: "myAsset_geo_v003" → "myAsset_geo" string pathSplit[] = split(s@path, '_'); s@path = join(pathSplit[0:len(pathSplit) - 1], '_'); ``` ## How it works - `split(s@path, '_')` → array of tokens. - `[0:len(pathSplit) - 1]` → slice all tokens **except the last**. - `join(..., '_')` → re-glue with `_` separator. - **`join` is the inverse of `split`.** --- # Common Uses - **Remove version suffix** before referencing or material binding. - **Strip a department tag** from a USD primitive name to unify naming. - **Generalise a path** — match a prim regardless of its last component (then use the result as a key for grouping). --- # 🔗 Related - [[HOUDINI VEX|HOUDINI VEX]] — VEX hub. - [[VEX Make groups or Materials from Geometry Path|Groups / Materials from Geometry Path]] — sister snippet. - [[../../../PROTOCOL/FOUNDATION/PROTOCOL Naming Convention|PROTOCOL Naming Convention]] — path conventions this assumes.