string: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Modified to be the string function, with a note redirecting to the string data typ)
Tag: Reverted
m (The unmodified title should be "string" since it's in use throughout the wiki)
 
(One intermediate revision by the same user not shown)
Line 7: Line 7:
</syntaxhighlight>
</syntaxhighlight>
[[Category:Variable Type]]
[[Category:Variable Type]]
{{MacroFunction
|name=string
|version=1.3b48
|description=
Returns the string value that is passed in as another data type.  When passed a string, no change is made.  When a number is passed, it is returned as a string in its ''minimal representation'' (meaning as few characters as possible to produce an accurate value, ie. no leading zeroes or spaces and no plus sign for positive numbers).  When passed a JSON Object or JSON Array, the JSON will be converted to a string and returned without any formatting (no embedded newlines or whitespace).
{{Note|If you're looking for the {{code|string}} ''data type'', see {{Types:string|string type}}.}}
When formatting of the numeric value is required (such as leading spaces or zeroes, a forced plus/minus sign, a specific number of digits, and so on), use {{func|strformat}}.
|usage=
<syntaxhighlight lang="mtmacro" line>
string(val)
</syntaxhighlight>
|also=
{{func|number}}
}}
[[Category:String Function]]

Latest revision as of 23:59, 23 November 2023

A string in MapTool is a series of alphanumeric characters enclosed in single or double quotation marks.

Example

[h:exampleString = "This is an example string."]