VirtualVariable.IFormat(String) Method

Top 

Description

Converts the number held by the calling object into a string based on the specified format specifiers. The format specifiers are standard C/C++ specifiers as used with the sprintf function. The IFormat method converts an integer value to a string; the Format method should be used to convert a double precision floating point value to a string.

 

The format is specified using the syntax shown below.  Each field is a single character or a number signifying a particular format option.  The flag(s), width, precision, and length are optional.  The simplest format specifications contain only the percent sign and a type character (for example, "%f").  For more information, see the Parsing Arbitrary String Data reference.

 

%[flags][width][.precision][length]type

 

Flags

Description

-

Left-justify.

+

Always include a plus or minus sign.

(space)

Include a space if no sign will be written.

#

Use alternate form.

0

Left-pad with zeros instead of spaces.

 

 

Width

Description

(number)

Minimum number of characters to be printed.

 

 

Precision

Description

(number)

Minimum number of digits to be written for integer types; number of digits after the decimal point for floating point types; maximum number of characters to be printed for string types.

 

 

Length

Description

h

Short integer

l

Long integer

L

Long double

I64

64-bit integer

 

 

Type

Description

Use With

d or i

Signed decimal integer

IFormat

u

Unsigned decimal integer

IFormat

o

Unsigned octal integer

IFormat

x or X

Unsigned hexadecimal integer (lowercase or uppercase)

IFormat

f

Decimal floating point

Format

e or E

Scientific notation (lowercase or uppercase)

Format

g or G

The shorter representation of decimal floating point or scientific notation (lowercase or uppercase)

Format

a or A

Hexadecimal floating point (lowercase or uppercase)

Format

c

Character

IFormat

s

String of characters

Format

 

 

Timing Precision Mode

This page describes functionality in millisecond timing precision mode. Millisecond timing precision mode is deprecated and will be removed in a future release. We recommend that you migrate your Mission Plans to nanosecond timing precision mode.

Click here to see the documentation for this object in nanosecond timing precision mode.

 

Method Signature

VirtualVariable.IFormat(

String formatString)

 

 

Arguments

formatString


Description:

Format specifier to use when converting the calling integer VirtualVariable into a String.

 

 

 

Return Value

Type:

string

 

 

Converts an integer value to a string. If the calling VirtualVariable is not an integer, only the integer part of the value will be used.

 

Syntax

myString1 = mySpacecraft1.A.IFormat(myString2);

 

 

See also

VirtualVariable Object