Announcement

Collapse
No announcement yet.

Convert Number to String

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Convert Number to String

    Hi all,

    may be I'm a fool, but I'm not able to find a solution. I need something like itoa or ltoa.

    I like to fill such a line with different values with code and not by hand.

    Code:
    var s := "600\n   \n500\n   \n400\n   \n300\n   \n200\n   \n100\n   \n000\n";
    Thanks for any tip.
    Kai
    Animated Scale Cockpit Displays at https://plastes.de

  • #2

    You can use to() followed by print to do that. eg

    func main()
    var i,j,k,l,m,n,o ;
    var s[30] ;
    i := 600 ;
    j := 500 ;
    k := 400 ;
    l := 300 ;
    m := 200 ;
    n := 100 ;
    o := 0 ;

    to(s) ;
    print(i, "\n ", j, "\n ", k, "\n ", l, "\n ", m, "\n ", n, "\n ", [DEC3Z] o, "\n") ;

    print([STR] s) ;

    repeat // maybe replace
    forever // this as well

    endfunc
    Mark

    Comment


    • #3
      Dear Mark,

      thanks for Your idea.

      This is my dynamic code.

      Code:
      var sSpeed[90];
      var n := 0;
      
      to(sSpeed);
      print("");
      for (n := 600; n >= 0; n -= 100)
        to(APPEND);
        print([DEC3Z]n, "\n    \n");
      next
      
      print([STR]sSpeed);
      Greetings Kai
      Animated Scale Cockpit Displays at https://plastes.de

      Comment

      Working...
      X