21.08.2013 Views

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Strings 51<br />

A , represents the character that the operating system uses for a thousands separator, and<br />

the # stands for a digit or place that is only displayed if it is required by the input string.<br />

MyFormat = "#,##0.00"<br />

MyString = Format(-1579.8, MyFormat) ' Provides "-1.579,80"<br />

MyString = Format(1579.8, MyFormat) ' Provides "1.579,80"<br />

MyString = Format(0.4, MyFormat) ' Provides "0,40"<br />

MyString = Format(0.434, MyFormat) ' Provides "0,43"<br />

In place of the $ place holder, the Format function displays the relevant currency symbol<br />

defined by the system (this example assumes a European locale has been defined):<br />

MyFormat = "#,##0.00 $"<br />

MyString = Format(-1579.8, MyFormat) ' Provides "-1.579,80<br />

€"<br />

MyString = Format(1579.8, MyFormat) ' Provides "1.579,80<br />

€"<br />

MyString = Format(0.4, MyFormat) ' Provides "0,40 €"<br />

MyString = Format(0.434, MyFormat) ' Provides "0,43 €"<br />

The format instructions used in VBA for formatting date and time details can also be used:<br />

sub main<br />

dim myDate as date<br />

myDate = "01/06/98"<br />

TestStr = Format(myDate, "mm-dd-yyyy") ' 01-06-1998<br />

MsgBox TestStr<br />

end sub<br />

Source: http:/ / <strong>wiki</strong>. services. openoffice. <strong>org</strong>/ w/ index. php? title=Documentation/ <strong>BASIC</strong>_<br />

<strong>Guide</strong>/ Strings_ (Runtime_ Library)&oldid=108124<br />

Principal Authors: Fpe, Ccornell, TJFrazier, SingleTrackMind

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!