CircuitGizmos

Electronic Products for Creative Minds

  • Home
  • Gizmo Store/Products
  • Documentation/Datasheets
  • Projects/Libraries
  • GizmoBlog
  • Services/Contact
    • Design
    • Contact Gizmo!
  • Your Gizmo Cart
    • Your Account
You are here: Home / GizmoBlog / MMBasic Language / Character and String Functions / STR$

STR$

STR$( number )

MMbasic 4.5: Returns a string in the decimal (base 10) representation of ‘number’.


this$ = STR$(123)

PRINT this$

123


STR$( number )

STR$( number, m )

STR$( number, m, n )

STR$( number, m, n, c$ )

MMbasic 5.0:  Returns a string in the decimal (base 10) representation of ‘number’.

If ‘m’ is specified sufficient spaces will be added to the start of the number to ensure that the number of characters before the decimal point (including the negative sign) will be at least ‘m’ characters. If ‘m’ is zero or the number has more than ‘m’ significant digits no padding spaces will be added. If ‘m’ is negative the plus symbol will be added to the start of positive numbers and then padded with leading spaces if required.

‘n’ is the number of digits required to follow the decimal place. The maximum value is seven and if ‘n’ is zero the string will be returned without the decimal point. If ‘n’ is not specified then the number of decimal places will vary according to the number.

‘c$’ is a string and if specified the first character of this string will be used as the padding character instead of a space (see the ‘m’ argument).


 

STR$(123.456) will return "123.456"
STR$(123.456, 6) will return " 123.456"
STR$(-123.456, 6) will return " -123.456"
STR$(-123.456, 6, 5) will return " -123.45600"
STR$(53, 6) will return " 53"
STR$(53, 6, 2) will return " 53.00"
STR$(53, 6, 2, "*") will return "****53.00"


 

See also:
ASC
BIN$
CHR$
DATE$
HEX$
LEN
OCT$
TIME$
VAL

Applies to:

CGCOLORMAX

CGMMSTICK

CGMICROBOARD

CGMICROMITE

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

A Ton of Documentation

Open all | Close all

Projects made by Gizmo, Friends, and Members

open all | close all

Recent GizmoBlog Musings

  • Altair 8800 using a ColorMax!
  • Re-energizing the ColorMax, Pt. 3

Visit us!

  • Facebook

Electronic Products for Creative Minds

CircuitGizmos is your source for electronic products that help you create your embedded projects. Here at CircuitGizmos.com you will find a friendly store filled with creative products and all of the documentation that you need to use these gizmos.

We create devices that we believe make electronics fun, but we also know that our products are used for professional designs. For decades we have designed products for commercial, military, and medical industries. Our gizmos here are great for engineers and hobbyists alike.

Copyright © 2008+ CircuitGizmos, L.L.C. All rights reserved

Image already added

Recently Viewed Products

Copyright © 2023 · Generate Pro Theme on Genesis Framework · WordPress · Log in