다음을 통해 공유


NumberFormatInfo.CurrencyGroupSeparator 속성

통화 값에서 정수 부분을 구분하는 문자열을 가져오거나 설정합니다.

네임스페이스: System.Globalization
어셈블리: mscorlib(mscorlib.dll)

구문

‘선언
Public Property CurrencyGroupSeparator As String
‘사용 방법
Dim instance As NumberFormatInfo
Dim value As String

value = instance.CurrencyGroupSeparator

instance.CurrencyGroupSeparator = value
public string CurrencyGroupSeparator { get; set; }
public:
property String^ CurrencyGroupSeparator {
    String^ get ();
    void set (String^ value);
}
/** @property */
public String get_CurrencyGroupSeparator ()

/** @property */
public void set_CurrencyGroupSeparator (String value)
public function get CurrencyGroupSeparator () : String

public function set CurrencyGroupSeparator (value : String)

속성 값

통화 값에서 정수 부분을 구분하는 문자열입니다. InvariantInfo 기본값은 ","입니다.

예외

예외 형식 조건

ArgumentNullException

속성이 Null 참조(Visual Basic의 경우 Nothing)로 설정되는 경우

InvalidOperationException

속성이 설정되어 있으며 NumberFormatInfo는 읽기 전용인 경우

설명

이 속성의 초기 값은 제어판의 국가별 옵션 설정을 따릅니다.

예제

다음 코드 예제에서는 CurrencyGroupSeparator 속성의 변경 내용이 적용된 결과를 보여 줍니다.

Imports System
Imports System.Globalization

Class NumberFormatInfoSample
   
   
   Public Shared Sub Main()

      ' Gets a NumberFormatInfo associated with the en-US culture.
      Dim nfi As NumberFormatInfo = New CultureInfo("en-US", False).NumberFormat

      ' Displays a value with the default separator (",").
      Dim myInt As Int64 = 123456789
      Console.WriteLine(myInt.ToString("C", nfi))

      ' Displays the same value with a blank as the separator.
      nfi.CurrencyGroupSeparator = " "
      Console.WriteLine(myInt.ToString("C", nfi))

   End Sub 'Main 

End Class 'NumberFormatInfoSample

 

'This code produces the following output.

'

'$123,456,789.00

'$123 456 789.00

using System;
using System.Globalization;

class NumberFormatInfoSample {

   public static void Main() {

      // Gets a NumberFormatInfo associated with the en-US culture.
      NumberFormatInfo nfi = new CultureInfo( "en-US", false ).NumberFormat;

      // Displays a value with the default separator (",").
      Int64 myInt = 123456789;
      Console.WriteLine( myInt.ToString( "C", nfi ) );

      // Displays the same value with a blank as the separator.
      nfi.CurrencyGroupSeparator = " ";
      Console.WriteLine( myInt.ToString( "C", nfi ) );

   }
}


/* 
This code produces the following output.

$123,456,789.00
$123 456 789.00
*/
   
using namespace System;
using namespace System::Globalization;
int main()
{
   
   // Gets a NumberFormatInfo associated with the en-US culture.
   CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false );
   NumberFormatInfo^ nfi = MyCI->NumberFormat;
   
   // Displays a value with the default separator (S", ").
   Int64 myInt = 123456789;
   Console::WriteLine( myInt.ToString( "C", nfi ) );
   
   // Displays the same value with a blank as the separator.
   nfi->CurrencyGroupSeparator = " ";
   Console::WriteLine( myInt.ToString( "C", nfi ) );
}

/* 
This code produces the following output.

$123, 456, 789.00
$123 456 789.00
*/
import System.*;
import System.Globalization.*;

class NumberFormatInfoSample
{
    public static void main(String[] args)
    {
        // Gets a NumberFormatInfo associated with the en-US culture.
        NumberFormatInfo nfi = 
            (new CultureInfo("en-US", false)).get_NumberFormat();
        // Displays a value with the default separator (",").
        Int64 myInt = (Int64)123456789;
        Console.WriteLine(myInt.ToString("C", nfi));
        // Displays the same value with a blank as the separator.
        nfi.set_CurrencyGroupSeparator(" ");
        Console.WriteLine(myInt.ToString("C", nfi));
    } //main 
} //NumberFormatInfoSample

/* 
This code produces the following output.

$123,456,789.00
$123 456 789.00
*/

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

NumberFormatInfo 클래스
NumberFormatInfo 멤버
System.Globalization 네임스페이스
NumberFormatInfo.CurrencyDecimalDigits 속성
NumberFormatInfo.CurrencyDecimalSeparator 속성
CurrencyGroupSizes
CurrencySymbol
CurrencyNegativePattern
CurrencyPositivePattern
NumberGroupSeparator
PercentGroupSeparator