STR/de

(Difference between revisions)
Jump to: navigation, search
((**COPIED FROM ENGLISH PAGE**) =)
(Remarks)
Line 15: Line 15:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
= <span class="f_Header">Remarks</span> =
+
= <span class="f_Header">Anmerkungen</span> =
 
<div style="padding: 0px; margin: 0px 0px 0px 4px;">
 
<div style="padding: 0px; margin: 0px 0px 0px 4px;">
 
{| width="487" cellspacing="0" cellpadding="1" border="1" style="border: 2px solid rgb(0, 0, 0); border-spacing: 0px; border-collapse: collapse;"
 
{| width="487" cellspacing="0" cellpadding="1" border="1" style="border: 2px solid rgb(0, 0, 0); border-spacing: 0px; border-collapse: collapse;"
Line 23: Line 23:
  
 
| valign="top" width="100%" style="width: 414px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="100%" style="width: 414px; border: 1px solid rgb(0, 0, 0);" |  
A string variable.
+
Zeichenkettenvariable.
  
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
 
| valign="top" width="14%" style="width: 64px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="14%" style="width: 64px; border: 1px solid rgb(0, 0, 0);" |  
X
+
x
  
 
| valign="top" width="100%" style="width: 414px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="100%" style="width: 414px; border: 1px solid rgb(0, 0, 0);" |  
A numeric variable.
+
Numerische Variable.
  
 
|}
 
|}
Line 36: Line 36:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
[http://avrhelp.mcselec.com/notice.jpgThe http://avrhelp.mcselec.com/notice.jpgThe] string must be big enough to store the result. So if you have a string like this&nbsp;: Dim S as string * 4, and you use it on a single with the value 0.00000001 then there is not enough space in the string to hold the result. Strings that are assigned with Str() should be dimmed 16 characters long.
+
[http://avrhelp.mcselec.com/notice.jpg] The string must be big enough to store the result. So if you have a string like this&nbsp;: Dim S as string * 4, and you use it on a single with the value 0.00000001 then there is not enough space in the string to hold the result. Strings that are assigned with Str() should be dimmed 16 characters long.
  
 
&nbsp;
 
&nbsp;

Revision as of 22:45, 1 March 2013

Contents

Funktion

Gibt die Zeichenketten-Darstellung einer Zahl zurück.

 

 

Syntax

var = STR( x)

 

 

Anmerkungen

var

Zeichenkettenvariable.

x

Numerische Variable.

 

[1] The string must be big enough to store the result. So if you have a string like this : Dim S as string * 4, and you use it on a single with the value 0.00000001 then there is not enough space in the string to hold the result. Strings that are assigned with Str() should be dimmed 16 characters long.

 

You do not need to convert a variable into a string before you print it.

When you use PRINT var, then you will get the same result as when you convert the numeric variable into a string, and print that string.

The PRINT routine will convert the numeric variable into a string before it gets printed to the serial port.

 

As the integer conversion routines can convert byte, integer, word and longs into a string it also means some code overhead when you do not use longs. You can include the alternative library named mcsbyte.lbx then. This library can only print bytes. There is also a library for printing integers and words only. This library is named mcsbyteint.

When you use these libs to print a long you will get an error message.

 

 

See also

VAL , HEX , HEXVAL , MCSBYTE , BIN , STR2DIGITS

 

 

Difference with VB

In VB STR() returns a string with a leading space. BASCOM does not return a leading space.

 

 

 

Example


Dim A As Byte , S As String * 10
A = 123
S = Str(a)
Print S ' 123
'when you use print a, you will get the same result.
'but a string can also be manipulated with the string routines.
End

Languages   English Deutsch  
Personal tools
Namespaces
Variants
Actions
Navigation
In other languages
Language