Jump to content


- - - - -

String Formatting (Precision, Field Width, Fill Character)

string format formatting precision field width fill characters

  • Please log in to reply
No replies to this topic

#1 Jörg

Jörg

    Moderator

  • Moderators
  • 503 posts
  • LocationBerlin, Germany

Posted 19 December 2017 - 02:42 PM

There are a couple of formatting controls in CAESES if you put a floating point number into a string. Here is a simple example for the toString() command that uses the global formatting and a given precision:

number.toString("g",precision)

The command asString() gives you a bit more control. If you like to change the field width, precision or the fill character, then you can use this one:

string myString( asString(number,field_width,precision,fill_char) )

With this, it is easy to write (export) files with a custom format or create custom labels for the 3D view.

 

I have attached a project where you can try it out. There is also some console output that shows the results.

 

Cheers

Joerg

Attached Thumbnails

  • string_formatting.png

Attached Files


  • 0