String Providers
- 17 minutes to read
String Providers are keywords used in templates. This article provides a detailed description of each supported String Provider. To insert a String Provider into your template expansion, right click the template editor area and choose the Insert StringProvider… item from context menu.
Note
String Providers are inserted without their signature. If you need to pass one or more parameters, add them (enclosed in parentheses) after the String Provider name manually.
The table below allows you to quickly navigate to the description of any String Provider. The descriptions are presented successively after the table.
«?ActiveTagName»
Returns the name of the surrounding XAML tag.
«?AddQuotes(string)»
Position | Parameter | Description |
---|---|---|
1 | String | The string to add quotes to. |
Returns the string (passed as a parameter) with double quotes added to the beginning and end.
«?Date»
Returns the current date in the Short Date String format (e.g., “12 / 30 / 16”).
«?DateLong»
Returns the current date in the Long Date String format (e.g., “Friday, December 30, 2016”).
«?DateTimeNow([format_string])»
Position | Parameter | Description |
---|---|---|
1 | Format String (optional) | An optional format string to be passed to the .NET ToString() call. |
Returns the DateTime.Now call result in the specified string format.
«?Day([format_string])»
Position | Parameter | Description |
---|---|---|
1 | Format String (optional) | An optional format string to be passed to the .NET ToString() call on the “day” integer. |
Returns the day of the month.
«?DayOfWeek»
Returns the name of the weekday.
«?DecInteger(value)»
Position | Parameter | Description |
---|---|---|
1 | Value | The integer value to decrement in a hexadecimal (e.g., 0xFF) or decimal format. |
Decrements an integer (passed as a parameter) in a hex or decimal format. The output string is the decremented value in the same format as the input number.
«?DoubleInteger(value)»
Position | Parameter | Description |
---|---|---|
1 | Value | The integer value to double in a hexadecimal (e.g., 0xFF) or decimal format. |
Doubles the value of an integer (passed as a parameter) in a hex or decimal format. The output string is the doubled value in the same format as the input value.
«?EnumerableType(name)»
Position | Parameter | Description |
---|---|---|
1 | Name | The name of the object implementing the IEnumerable interface whose type shall be returned. |
Returns the IEnumerable type name of the specified variable.
«?EventNameFromField(field_name)»
Position | Parameter | Description |
---|---|---|
1 | Field Name | The field name to convert |
Converts a field name (passed as a parameter to this String Provider) to an event name.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?FileBase»
Returns the name of the active file (without a path to it and without an extension).
«?FileDrive»
Returns the drive letter of the active file (e.g., “C:").
«?FileExtension»
Returns the extension of the active file. (e.g. “.cs”)
«?FileName»
Returns the name of the active file, including the absolute path to it.
«?FilePath»
Returns the absolute path to the folder containing the active file.
«?FirstCamelCaseWord(text)»
Position | Parameter | Description |
---|---|---|
1 | Text | The text containing camel-case sequences. |
Returns the first camel-case sequence of characters (the first character of the specified string, plus all lower-case characters that follow) from the specified string parameter.
«?FormatConstantName(constant_name,[is_private],[is_local])»
Position | Parameter | Description |
---|---|---|
1 | Constant Name | The constant name to format |
2 | Is Private (optional) | Pass “true” if the constant is local. |
3 | Is Local (optional) | Pass “true” if the constant is private. |
Formats the specified identifier (passed as a parameter to this String Provider) so it matches the style specified for constant declarations.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?FormatEnumMemberName(enum_member_name)»
Position | Parameter | Description |
---|---|---|
1 | Enum Member Name | The enum member name to format. |
Formats the specified identifier (passed as a parameter to this String Provider) so it matches the style specified for enum members.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?FormatEventName(event_name)»
Position | Parameter | Description |
---|---|---|
1 | Event Name | The event name to format. |
Formats the specified identifier (passed as a parameter to this String Provider), so it matches the style specified for event declarations.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?FormatFieldName(field_name,[non-public],[is_static])»
Position | Parameter | Description |
---|---|---|
1 | Field Name | The field name to format. |
2 | Non-Public (optional) | Pass “true” if the field has non-public visibility. |
3 | Is Static (optional) | Pass “true” if the field is static. |
Formats the specified identifier (passed as a parameter to this String Provider), so it matches the style specified for field declarations.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?FormatInterfaceName(interface_name)»
Position | Parameter | Description |
---|---|---|
1 | Interface Name | The interface name to format. |
Formats the specified identifier (passed as a parameter to this String Provider), so it matches the style specified for interface declarations.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?FormatLocalName(local_variable_name)»
Position | Parameter | Description |
---|---|---|
1 | Local Variable Name | The local variable name to format. |
Formats the specified identifier (passed as a parameter to this String Provider) so it matches the style specified for local variable declarations.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?FormatMethodName(method_name)»
Position | Parameter | Description |
---|---|---|
1 | Method Name | The method name to format. |
Formats the specified identifier (passed as a parameter to this String Provider) so it matches the style specified for method declarations.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?FormatNamespaceName(namespace_name)»
Position | Parameter | Description |
---|---|---|
1 | Namespace Name | The namespace name to format. |
Formats the specified identifier (passed as a parameter to this String Provider), so it matches the style specified for namespace declarations.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?FormatParamName(parameter_name)»
Position | Parameter | Description |
---|---|---|
1 | Parameter Name | The parameter name to format. |
Formats the specified identifier (passed as a parameter to this String Provider) so it matches the style specified for parameter declarations.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?FormatPropertyName(property_name)»
Position | Parameter | Description |
---|---|---|
1 | Property Name | The property name to format. |
Formats the specified identifier (passed as a parameter to this String Provider), so it matches the style specified for property declarations.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?FormatTypeName(type_name)»
Position | Parameter | Description |
---|---|---|
1 | Type Name | The type name to format. |
Formats the specified identifier (passed as a parameter to this String Provider), so it matches the style specified for type declarations.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?FormatTypeParameterName(type_parameter_name)»
Position | Parameter | Description |
---|---|---|
1 | Type Parameter Name | The type parameter name to format. |
Formats the specified identifier (passed as a parameter to this String Provider), so it matches the style specified for type parameter declarations.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?GenerateOnPropertyChangedCall(property)»
Position | Parameter | Description |
---|---|---|
1 | Property | The property name. |
Returns an appropriate OnPropertyChanged method call for the specified property name. Returns an empty string if the OnPropertyChanged method is missing from the active type.
Note
The class in which this String Provider was invoked should implement the INotifyPropertyChanged interface.
«?Get(variable)»
Position | Parameter | Description |
---|---|---|
1 | Variable | The name of the variable to get a value for. This should be the same variable name passed to the Set string provider earlier, or if you are working with dynamic templates, it should match the name of the variable on the list created in the Template Name Variables options page. |
Returns the value of the specified variable. The detailed information about using the variables in templates is presented in the Using Variables topic.
«?GetIteratorName(name,type_name)»
Position | Parameter | Description |
---|---|---|
1 | Name | The name of a collection to iterate through. |
2 | Type Name | The type of the elements to iterate through. |
Returns an iterator variable name based on the name of a collection to iterate through.
«?GetPropertySuffix(field_name)»
Position | Parameter | Description |
---|---|---|
1 | Field Name | The name of the field to check. |
Returns property name suffix if the specified field name will be in conflict with property name obtained from the PropertyNameFromField String Provider.
«?GetTypeSuffix(name)»
Position | Parameter | Description |
---|---|---|
1 | Type Name | The name of the type for which to return the type suffix. |
Returns the type suffix that should be added right after a numeric literal to specify its type. For instance, “U” for UInt32 (the full literal will look like “42U”).
«?GetUniqueXamlName(base_name)»
Position | Parameter | Description |
---|---|---|
1 | Base Name | The string on which to base the generated name. If this string ends with a number, that number will be replaced with a number that makes the name unique. |
Returns a unique XAML name identifier based on the specified “Base Name” parameter. If the Base Name ends with a number, that number will be replaced with a number that makes the identifier unique.
«?GetUserFirstName»
Returns “First Name” value from the IDE | User Info options page.
«?GetUserInfo(key)»
Position | Parameter | Description |
---|---|---|
1 | Key | The key on the IDE | User Info options page for which to get the value. |
Returns a value from the IDE | User Info options page.
«?GetUserInitials»
The info is taken from the IDE | User Info options page. The “First Name” and “Middle Name” rows are considered.
«?GetUserLastName»
Returns “Last Name” value from the IDE | User Info options page.
«?GetUserMiddleName»
Returns “First Name” value from the IDE | User Info options page.
«?Hour([format_string])»
Position | Parameter | Description |
---|---|---|
1 | Format String (optional) | An optional format string passed to a ToString() call on the “hour” integer. |
Returns the hour for the current time.
«?IncInteger(value)»
Position | Parameter | Description |
---|---|---|
1 | Value | The integer value to increment in a hexadecimal (e.g., 0xFF) or decimal format. |
Increments an integer (passed as a parameter) in a hex or decimal format. The output string is the incremented value, in the same format as the input value.
«?InitialCap(text)»
Position | Parameter | Description |
---|---|---|
1 | Text | The text to initial-cap. |
Uppercases the first letter of the string passed as a parameter to this String Provider.
«?InitialLow(text)»
Position | Parameter | Description |
---|---|---|
1 | Text | The text to change. The first letter of this text will be changed to lower-case, and that result will be returned. |
Lowercases the first letter of the string passed as a parameter.
«?InitialValueFromType(name)»
Position | Parameter | Description |
---|---|---|
1 | Name | The full name of the type (e.g., System.Boolean) to get the initial value for. |
Returns an initial value based on a full type name passed to it.
«?InvertBoolean(boolean_value)»
Position | Parameter | Description |
---|---|---|
1 | Boolean Value | The boolean value to invert. One of “true”, “True”, “false”, or “False”. |
Returns the logical opposite of the specified boolean constant (passed as a parameter). So “true” becomes “false”, and “False” becomes “True”.
«?LongestSelectedCodeLine»
Returns the length of the longest code line in the active selection, ignoring leading and trailing white space.
Note
A TextView must have focus when invoking this String Provider.
«?LongestSelectedLine»
Returns the length of the longest line in the active selection. Leading and trailing white space is included in the line length calculation.
Note
A TextView must have focus when invoking this String Provider.
«?LowerCase(text)»
Position | Parameter | Description |
---|---|---|
1 | Text | The text to lowercase. |
Lowercases the specified text (passed as a parameter to this String Provider).
«?Member»
Returns the name of the member (e.g., property, method, etc.) at the caret.
«?Method»
Returns the name of the method at the caret.
«?Minute([format_string])»
Position | Parameter | Description |
---|---|---|
1 | Format String (optional) | An optional format string passed to a ToString() call on the “minute” integer. |
Returns the minutes for the current time.
«?Month([format_string])»
Position | Parameter | Description |
---|---|---|
1 | Format String (optional) | An optional format string passed to a ToString() call on the “month” integer. |
Returns the current month.
«?Namespace»
Returns the active namespace name.
«?NamespaceFullName»
Returns the full name of the active namespace (e.g., DevExpress.CodeRush.Features.CSharp.Strings).
«?NearestLocalOfType(full_name)»
Position | Parameter | Description |
---|---|---|
1 | Full Name | The full name (e.g., “System.Boolean”) of the type. |
Returns the name of the nearest local variable of the specified type.
«?NewGuid([format])»
Position | Parameter | Description |
---|---|---|
1 | Format (optional) | The format of the GUID to be generated. |
Generates and returns new string GUID. This string provider accepts an optional format string. If a format string is not specified, then the “B” format is used.
«?Paste(remove_semicolon)»
Position | Parameter | Description |
---|---|---|
1 | Remove Semicolon | Set this parameter to “true” to delete a semicolon in the end of the text. |
Returns the text on the clipboard.
«?PasteArrayBaseType»
Returns the base type name of the array on the clipboard.
«?PasteFirstLine»
Returns the first line of the clipboard text.
«?PasteType»
Returns the full type name on the clipboard.
«?PrefixField»
Returns the prefix associated with field variables for the active language based on the “Instance Private Fields” settings.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?PrefixLocal»
Returns the prefix associated with local variables for the active language based on the “Local Variables” settings.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?PrefixMethod»
Returns the prefix associated with methods for the active language based on the “Methods” settings.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?PrefixParam»
Returns the prefix associated with parameters for the active language based on the “Parameters” settings.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?PrimitiveDefaultValue(name)»
Position | Parameter | Description |
---|---|---|
1 | Name | The full name of the type (e.g., “System.Boolean”) whose primitive initial value is returned. |
Returns a primitive initial value based on a full type name passed to it.
«?ProjectFileName»
Returns the path to the current project file.
«?ProjectName»
Returns the name of the current project.
«?PropertyNameFromField(field_name)»
Position | Parameter | Description |
---|---|---|
1 | Field Name | The field name to convert. |
Converts a field name (passed as a parameter to this String Provider) to a property name.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?PropertyNameFromLocal(local_variable_name)»
Position | Parameter | Description |
---|---|---|
1 | Local Variable Name | The name of a local variable to convert. |
Converts a local name (passed as a parameter to this String Provider) to a property name.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?PropertyNameFromParam(parameter_name)»
Position | Parameter | Description |
---|---|---|
1 | Parameter Name | The parameter name to convert. |
Converts a parameter name (passed as a parameter to this String Provider) to a property name.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?RemoveQuotes(string)»
Position | Parameter | Description |
---|---|---|
1 | String | String to remove quotes from. |
Returns the string passed as a parameter without double quotes.
«?Repeat(string,length)»
Position | Parameter | Description |
---|---|---|
1 | String | The sequence of characters to repeat. |
2 | Length | The desired length of the assembled string. |
Creates a string that repeats the specified sequence up to a specified maximum length.
«?ReturnType»
Returns the active member’s return type, or the name of the active Type, Structure or Interface if the caret is not inside a member.
«?ScopeConstant»
Returns the default scope (private, public, etc.) for constants (configured on the Editor | <Language> | Scope Options options page. Refer to the Scope topic for details).
«?ScopeEvent»
Returns the default scope (private, public, etc.) for events (configured on the Editor | <Language> | Scope Options options page. Refer to the Scope topic for details).
«?ScopeField»
Returns the default scope (private, public, etc.) for fields (configured on the Editor | <Language> | Scope Options options page. Refer to the Scope topic for details).
«?ScopeMethod(is_abstract)»
Returns the default scope (private, public, etc.) for methods (configured on the Editor | <Language> | Scope Options options page. Refer to the Scope topic for details).
Position | Parameter | Description |
---|---|---|
1 | Is Abstract | Defines if a member is abstract and if the scope cannot be private. |
Returns default scope (private, public, etc.) for properties (configured on the Editor | <Language> | Scope Options options page. Refer to the Scope topic for details).
«?ScopeNestedType»
Returns the default scope (private, public, etc.) for nested types (configured on the Editor | <Language> | Scope Options options page. Refer to the Scope topic for details).
«?ScopeProperty(is_abstract)»
Position | Parameter | Description |
---|---|---|
1 | Is Abstract | Defines if a member is abstract and if the scope cannot be private. |
Returns default scope (private, public, etc.) for properties (configured on the Editor | <Language> | Scope Options options page. Refer to the Scope topic for details).
«?ScopeType»
Returns default scope (private, public, etc.) for types (configured on the Editor | <Language> | Scope Options options page. Refer to the Scope topic for details).
«?Second([format_string])»
Position | Parameter | Description |
---|---|---|
1 | Format String (optional) | An optional format string passed to a ToString() call on the “seconds” integer. |
Returns the number of seconds for the current time.
«?Semicolon»
Returns a semicolon if needed.
«?Set(variable_name,value)»
Position | Parameter | Description |
---|---|---|
1 | Variable Name | The name of the variable to set. This same variable name, when passed to the Get string provider, will return the last string value set to this variable. |
2 | value | The string to assign to a Variable Name. This value will be returned from the next call to the Get String Provider with the Variable Name passed as a parameter. The detailed information about using the variables in templates is presented in the Using Variables topic. |
Sets a variable to a specified string for later use through the Get String Provider. Returns an empty string.
«?SimpleName(name)»
Position | Parameter | Description |
---|---|---|
1 | Name | The full simple name of the member. |
Returns the simple name based on the full member name passed to it.
«?SimpleStaticTypeName(name)»
Position | Parameter | Description |
---|---|---|
1 | Name | The full simple type name. |
Returns the simple type name based on the full type name passed to it.
«?SimpleTypeName(name)»
Position | Parameter | Description |
---|---|---|
1 | Name | The full simple type name. |
Returns the simple type name based on a full type name passed to it.
«?SolutionFileName»
Returns the full path to the solution file.
«?SolutionName»
Returns the name of the current solution.
«?SuffixField»
Returns the suffix associated with field variables for the active language based on the “Instance Private Fields” settings.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?SuffixLocal»
Returns the suffix associated with local variables for the active language based on the “Local Variables” settings.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?SuffixMethod»
Returns the suffix associated with methods for the active language based on the “Methods” settings.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?SuffixParam»
Returns the suffix associated with parameters for the active language based on the “Parameters” settings.
Note
Naming style options can be configured on the Editor | <Language> | Naming Conventions options page.
«?TextCommandBegin»
Returns the start character for a CodeRush Text Command («).
«?TextCommandEnd»
Returns the end character for a CodeRush Text Command (»).
«?Time»
Returns the time in the Short Time String format (e.g. “4:24 PM”).
«?TimeLong»
Returns the time in the Long Time String format (e.g. “4:24:59 PM”).
«?Type»
Returns the name of the type under the caret.
«?TypeFullName»
Returns the full name of the active type under the caret.
«?TypeKind»
Returns the keyword for the current type.
«?UpperCase(text)»
Position | Parameter | Description |
---|---|---|
1 | Text | The text to change. |
Uppercases the specified text (passed as a parameter to this String Provider).
«?UserName»
Returns the user name of the logged in user.
«?XmlDocCommentBegin»
Returns XML comment delimiters (“///“).
«?XMLMultilineDocCommentBegin»
Return XML Multiline Doc Comment Begin delimiter (“/**”).
«?XMLMultilineDocCommentEnd»
Returns XML Multiline Doc Comment End delimiter (“*/“).
«?Year([format_string])»
Position | Parameter | Description |
---|---|---|
1 | Format String (optional) | An optional format string passed to a ToString() call on the year integer. |
Returns the current year.