Bagikan melalui


CreateSafeName

Generates a C++ friendly name.

function CreateSafeName( 
   strName  
);

Parameters

  • strName
    The old name.

Return Value

The new, safe name.

Remarks

Call this function to create a C++ friendly name from a name that contains characters that cannot be used by C++. An acceptable C++ name can contain upper- or lowercase letters, digits, or an underscore ("_").

This function checks the old name character by character, skipping any unusable characters. If the old name contains no friendly characters, the function returns the new name as "My". If the new friendly name begins with a digit, this function prepends the new name with "My".

Example

// Get the project name
var strProjectName = wizard.FindSymbol("PROJECT_NAME");

// Set the project name to the safe project name. 
var strSafeProjectName = CreateSafeName(strProjectName);

See Also

Tasks

Creating a Custom Wizard

Concepts

Customizing C++ Wizards with Common JScript Functions

Designing a Wizard

Other Resources

JScript Functions for C++ Wizards