View Full Version : Trim the length of a string?
PhillipCrond 01-13-2006, 05:15 AM How would I trim the length of a string? Like, take a long file name and truncate it down to 10 characters. Or trim the last three characters off a string.
Thanks a ton!
Brent
|
|
lostfilez
01-13-2006, 05:48 AM
Use the substring command, for example
string $myControl = "L_Shoulder_C";
string $newName = `substring $myControl 1 10`;
1 being the # of the character to start with, and 10 being the # to end with, leaving you with "L_Shoulder".
DezFX
01-13-2006, 07:45 AM
To strip off the last # characters of a string you can use the endString and basename commands.
string $testStr = "Muppetland";
string $endStr = endString($testStr, 4);
basename($testStr, $endStr);
// Result: Muppet //
brubin
01-13-2006, 12:45 PM
more elaboration on this topic:
http://www.ewertb.com/maya/mel/mel.php?howto=94
HIH
s.
CGTalk Moderation
01-13-2006, 12:45 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.