Templates

Top  Previous  Next

String templates can be used to quickly replace specific sub-strings in a large string with another string.

 

It detects names surrounded by specific characters, which can then be replaced when generating new strings.

 

The string template functions are only available in NX32L compilation mode.

 

String templates use the following steps:

1.Call strTemplateCreate with the source string to generate the template

2.Optional: Use strTemplateVarInfo to examine the found variables.

3.Use strTemplateSetVar to set the value to use for the variables.

4.Call strTemplateGenerateString to generate a string with the new variables.

5.Repeat step 3 and 4 as many times as needed.

6.Call strTemplateFree to release the string template.

 

Note: To avoid having to escape special characters in the source string, the string can be defined as a raw string, see STRING_BEGIN for more details.

 

 

 


strTemplateCreate

Create a string template to perform fast replacement of sub-strings.


strTemplateFree

Release the string template,


strTemplateVarInfo

Get information about the variables found in the string template.


strTemplateSetVar

Update the value of a variable in the string template.


strTemplateGenerateString

Generate a string from the string template.