我正在尝试使用货币格式开头的“$”格式化货币。
我该怎么做?我试过这个,但它不起作用:
#include <vector>
#include <iostream>
struct MemoryManager
{
static void* allocate( unsigned size )
{
static char block[256];
return block;
}
};
class Foo
{
public:
void* operator new[]( size_t size )
{
std::cout << "operator new[] : data size -- " << size << std::endl;
return MemoryManager::allocate( size );
}
private:
std::vector<long> m_dummy; // Huh?
unsigned m_num;
};
int main( int argc, char * argv[] )
{
std::cout << "Foo size: " << sizeof( Foo ) << std::endl;
new Foo [4];
Foo::operator new[]( 4 * sizeof( Foo ) );
}
我知道$ 1,234是:
let fetch = CNContactFetchRequest(...)
fetch.sortOrder = .UserDefault
但我想删除
$
在货币面前。
答案 0 :(得分:0)
Dim value As Double = e.Row.Cells(7).Text
Dim val2 As String
val2 = (value.ToString("#,#", CultureInfo.InvariantCulture))
e.Row.Cells(7).Text = String.Format(CultureInfo.InvariantCulture, "{0:#,#}", val2)
不要忘记
Imports System.Globalization
答案 1 :(得分:0)
TrimStart()
功能
Dim strVal As String = "$1,234"
strVal = strVal.TrimStart("$")
replace()
功能
Dim strVal As String = "$1,234"
strVal = strVal.Replace("$",String.Empty)
你可以像这样使用
e.Row.Cells(7).Text = e.Row.Cells(7).Text.TrimStart("$")
或
e.Row.Cells(7).Text = e.Row.Cells(7).Text.Replace("$",String.Empty)