Contents - Index



String$ accepts one or two arguments.  The first argument must be a numerical constant, variable, or expression that will be converted into a string and returned by the function.  The second argument is optional.  If a second argument is provided, it is assumed to be the format specification for the value.  Format specifications consist of two characters.  The first character can be A, E, F, G, or T, which indicate Auto format, E-format, fixed decimal format, engineering format, or time format, respectively.  The second character is the number of significant figures.  If a second argument is not provided, the value will be converted to a string using Auto format.


The StringVal function provides the inverse operation, converting a string to numerical value.


Examples: R$=CONCAT$('R',String$(10+12))  "R$ is set to 'R22'"


                 F$='R'||string$(10+12)||' is a common refrigerant'


                 V=9.1234565;  V$=String$(V,'F1')   "V$ is set to '9.1'"


                 id=1234567;     ID$=string$(id,'F0')   "ID$ is set to '1234567'


                 D=43000;     D$=string$(D,'D1')   "D$ is set to '22/09/2017'


                 T=23.5;     T$=string$(T,'T0')   "T$ is set to '11:30:00 PM'


Set also:  TIME$



Return to String Functions