formatstrings for Lcd.WriteText or anything

HomeForumsMonoBrick EV3 Firmwareformatstrings for Lcd.WriteText or anything

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #4245
    Author Image
    Helmut Wunder
    Participant

    hello,
    is it possible to use formatstrings for
    Lcd.WriteText(f, new Point (0, 10), Convert.ToString(touchSensor.IsPressed()), true);
    like it is possible for C printf, e.g.
    %d, %2d, %3d, %-4d, %f, %4f, %-5.2f, %c, %s, %x, %2x,… and linefeed (\n) ?
    e.g.
    printf("%2d ply, %9d searched, %6d by (%2x,%2x)\n",d-1,N,m,X,Y&0x77)

    #4248
    Author Image
    Anders Søborg
    Keymaster

    Hi

    Try to look at LcdConsole class found here

    As well as the LCD example found here

    Anders

    #4252
    Author Image
    Helmut Wunder
    Participant

    thank you, I already found this, but I don’t see information about this C-equivalent formatstring and multi-Variable-formatting. I guess C# is quite different from C, probably still a lot to learn anew…

    #4255
    Author Image
    Anders Søborg
    Keymaster

    Hi

    In C# most classes will have a tostring that you can use…

    Anders

    #4257
    Author Image
    Berni
    Participant

    Look here for some examples.

    http://www.dotnetperls.com/string-format

    • This reply was modified 10 years, 7 months ago by Author ImageBerni.
    • This reply was modified 10 years, 7 months ago by Author ImageBerni.
    #4260
    Author Image
    Helmut Wunder
    Participant

    Berni,
    thank you for your post!
    In C# formatting appears to be far more complicated than when using C (“%3d”, “%5.2f”,…) so it will take some time until I will have learned that stuff. I’m curious if it once will be possible to simplify this issue by having inline functions (like wraps around the C# functions)…

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

Posted in

Make a donation