Difference between revisions of "MC-Basic:STRD$"

From SoftMC-Wiki
Jump to: navigation, search
 
(13 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
{{Languages|MC-Basic:STRD$}}
 
{{MC-Basic
 
{{MC-Basic
 
|SHORT FORM=
 
|SHORT FORM=
Line 4: Line 5:
  
 
|SYNTAX=
 
|SYNTAX=
STRD$(''<number>'', ''<format_string>'')
+
STRD$(<''number''>, <''format_string''>)
  
 
|AVAILABILITY=
 
|AVAILABILITY=
Line 12: Line 13:
  
 
|TYPE=
 
|TYPE=
''<return value>'': String<br>
+
<''return value''>: String<br>
''<number>'': Double, Long<br>
+
<''number''>: Double, Long<br>
''<format_string>'': String<br>
+
<''format_string''>: String<br>
  
 
|RANGE=
 
|RANGE=
''<number>'': MinDouble to MaxDouble<br>
+
<''number''>: MinDouble to MaxDouble<br>
''<format_string>'': a valid sprintf() floating point format
+
<''format_string''>: a valid sprintf() floating point format
  
 
<pre>
 
<pre>
%f - the output is presented in a non-exponent style
+
%f - a non-exponential display
%e, %E - the output is presented in an exponent style
+
%e, %E - an exponential display
%g, %G - the output's style depends on the value of the input  
+
%g, %G - type of display depends on the value of the input  
 
</pre>
 
</pre>
 +
 +
{{Note/Warning| '''If an invalid format string is used, the behavior is undefined'''}}
 +
  
 
|UNITS=
 
|UNITS=
Line 41: Line 45:
 
-->PRINT STRD$(45.5, "%f")<br>
 
-->PRINT STRD$(45.5, "%f")<br>
 
45.500000<br>
 
45.500000<br>
 +
-->PRINT STRD$(45.5,"%e")<br>
 +
4.550000e+01<br>
 
-->PRINT STRD$(45.5,"%g")<br>
 
-->PRINT STRD$(45.5,"%g")<br>
45.5<br>
+
45.5
-->PRINT STRD$(45.5,"%e")<br>
 
4.550000e+01
 
  
 
|SEE ALSO=
 
|SEE ALSO=
* [[Axystems:MC-Basic:VAL|VAL]]
+
* [[MC-Basic:VAL|VAL]]
* [[Axystems:MC-Basic:STR$|STR$]]
+
* [[MC-Basic:STR$|STR$]]
* [[Axystems:MC-Basic:STRL$|STRL$]]
+
* [[MC-Basic:STRL$|STRL$]]
  
[[Category:Axystems:MC-Basic:String_Manipulation|STRD$]]
+
[[Category:MC-Basic:String Manipulation|STRD$]]
 
}}
 
}}

Latest revision as of 08:29, 28 April 2017

Language: English  • 中文(简体)‎

STRD$ returns the string representation of a double-type number.

Syntax

STRD$(<number>, <format_string>)

Type

<return value>: String
<number>: Double, Long
<format_string>: String

Range

<number>: MinDouble to MaxDouble
<format_string>: a valid sprintf() floating point format

%f - a non-exponential display 
%e, %E - an exponential display
%g, %G - type of display depends on the value of the input 
WARNING.svgWARNING
If an invalid format string is used, the behavior is undefined

Scope

Configuration, Task or Terminal

Limitations

Read only

Examples

-->PRINT STRD$(45.5, "%f")
45.500000
-->PRINT STRD$(45.5,"%e")
4.550000e+01
-->PRINT STRD$(45.5,"%g")
45.5

See Also