Is it possible to Create a Data Folder using a name contained in a string

Is it possible to Create a Data Folder using a name contained in a string.

From a function I want create, kill, change to a data folder with name of data folder contained in a string. Is this possible and if so how?  

 

Mike G

NewDataFolder [/O/S] dataFolderSpec

 

For dataFolderSpec use $String

NewDataFolder $String

 

Where String is the name of your string.

Hi Mike,

Short answer: yes

Function FutzWithDataFolder(theName,What)
    string theName
    String What
   
    strswitch (What)    // string switch
        case "Make":    // execute if case matches expression
            NewdataFolder $theName
            break   // exit from switch
        case "Kill":    // execute if case matches expression
            KillDataFolder/Z $theName
            break
    endswitch

End

I have left the change up to the reader since it requires an additional input.

Andy