다음을 통해 공유


NumberFormatInfo.PercentDecimalSeparator 속성

백분율 값에서 소수 구분 기호로 사용하는 문자열을 가져오거나 설정합니다.

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

구문

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

value = instance.PercentDecimalSeparator

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

/** @property */
public void set_PercentDecimalSeparator (String value)
public function get PercentDecimalSeparator () : String

public function set PercentDecimalSeparator (value : String)

속성 값

백분율 값에서 소수 구분 기호로 사용하는 문자열입니다. InvariantInfo 기본값은 ","입니다.

예외

예외 형식 조건

ArgumentNullException

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

InvalidOperationException

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

ArgumentException

이 속성이 빈 문자열로 설정된 경우

예제

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

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 [Double] = 0.1234
      Console.WriteLine(myInt.ToString("P", nfi))

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

   End Sub 'Main 

End Class 'NumberFormatInfoSample


'This code produces the following output.

'

'12.34 %

'12 34 %

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 (".").
      Double myInt = 0.1234;
      Console.WriteLine( myInt.ToString( "P", nfi ) );

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

   }
}


/* 
This code produces the following output.

12.34 %
12 34 %
*/
   
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".").
   Double myInt = 0.1234;
   Console::WriteLine( myInt.ToString( "P", nfi ) );
   
   // Displays the same value with a blank as the separator.
   nfi->PercentDecimalSeparator = " ";
   Console::WriteLine( myInt.ToString( "P", nfi ) );
}

/*
This code produces the following output.
12.34 %
12 34 %
*/
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 (".").
        System.Double myInt = (System.Double)0.1234;
        Console.WriteLine(myInt.ToString("P", nfi));
        // Displays the same value with a blank as the separator.
        nfi.set_PercentDecimalSeparator(" ");
        Console.WriteLine(myInt.ToString("P", nfi));
    } //main 
} //NumberFormatInfoSample

/* 
This code produces the following output.

12.34 %
12 34 %
*/

플랫폼

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.PercentDecimalDigits 속성
PercentGroupSeparator
PercentGroupSizes
PercentSymbol
PercentNegativePattern
PercentPositivePattern
NumberFormatInfo.CurrencyDecimalSeparator 속성
NumberFormatInfo.NumberDecimalSeparator 속성