Removing characters from a string

I'm in the process of building a UI for a script I have been working on. In th UI I have generated a "for in" loop that I use to populate the layout of the UI. I'm generating each UI element from the "listAttr" command. The difficulty I am having is small. Some Attributes have a "." in the name of the attribute. For example "instObjGroups.objectGroups". In the last line of my example "for in" loop I designate the name of the UI checkbox. I'd like to parse $attrName to remove all periods from strings passed to this procedure located at the last line of my example.

Any help would be great.

Mike

for ( $attrName in listAttr -c -w){
checkBoxGrp
-numberOfCheckBoxes 1
-label1 $attrName
(($attrName)+"_chkbx");
}

Maybe there's an easier way, but you could tokenize your string with the period, then add the results back together:

string $oldtext = "abcd.efg";
string $buffer[];
tokenize $oldtext "." $buffer;
string $buff;
string $newtext = "";
for ($buff in $buffer)
$newtext = $newtext + $buff;
print ($newtext + "n");

Check out the substitute and substituteAllString commands. It should allow you replace every occurrence of "." with "" or "_" or whatever you might want.

--JeffD

I wanted to thank you guys for your input. Last night in a late drowsy programming marathon I came up with this procedure. Seems to work very nicely and is quite simple.

global proc string do_parseAttr (string $attrName){
$attrName= substituteAllString($attrName, ".", "");
$attrName= substituteAllString($attrName, "-", "0");
$attrName= substituteAllString($attrName, "+", "1");

return $attrName;

}