Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In both C# and VB.NET you can use either the <a href="http://www.java2s.com/Code/CSharp/Development-Class/UseToStringtoformatvalues.htm" rel="nofollow noreferrer">.ToString()</a> function or the <a href="http://www.java2s.com/Code/CSharp/Development-Class/UseStringFormattoformatavalue.htm" rel="nofollow noreferrer">String.Format()</a> method to format the text. </p> <p>Using the .ToString() method your example could be written as:</p> <pre><code>JSArrayString += "^" + (inv.RRP * oCountry.ExchangeRate).ToString("#0.00") </code></pre> <p>Alternatively using the String.Format() it could written as:</p> <pre><code>JSArrayString = String.Format("{0}^{1:#0.00}",JSArrayString,(inv.RRP * oCountry.ExchangeRate)) </code></pre> <p>In both of the above cases I have used custom formatting for the currency with # representing an optional place holder and 0 representing a 0 or value if one exists. </p> <p>Other formatting characters can be used to help with formatting such as D2 for 2 decimal places or C to display as currency. In this case you would not want to use the C formatter as this would have inserted the currency symbol and further separators which were not required.</p> <p>See "<a href="http://idunno.org/archive/2004/14/01/122.aspx" rel="nofollow noreferrer">String.Format("{0}", "formatting string"};</a>" or "<a href="http://www.csharp-examples.net/string-format-int/" rel="nofollow noreferrer">String Format for Int</a>" for more information and examples on how to use String.Format and the different formatting options.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload