NumberFormatInfo.PercentGroupSeparator 属性     
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置在百分比值中隔离小数点左边数字组的字符串。
public:
 property System::String ^ PercentGroupSeparator { System::String ^ get(); void set(System::String ^ value); };
	public string PercentGroupSeparator { get; set; }
	member this.PercentGroupSeparator : string with get, set
	Public Property PercentGroupSeparator As String
	属性值
在百分比值中隔开小数点左边的位数组的字符串。 InvariantInfo 默认为“,”。
例外
该属性设置为 null。
设置了该属性,但 NumberFormatInfo 对象为只读。
示例
下面的示例演示更改 PercentGroupSeparator 属性的效果。
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 = 1234.5678;
   Console::WriteLine( myInt.ToString( "P", nfi ) );
   
   // Displays the same value with a blank as the separator.
   nfi->PercentGroupSeparator = " ";
   Console::WriteLine( myInt.ToString( "P", nfi ) );
}
/*
This code produces the following output.
123, 456.78 %
123 456.78 %
*/
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 = 1234.5678;
      Console.WriteLine( myInt.ToString( "P", nfi ) );
      // Displays the same value with a blank as the separator.
      nfi.PercentGroupSeparator = " ";
      Console.WriteLine( myInt.ToString( "P", nfi ) );
   }
}
/*
This code produces the following output.
123,456.78 %
123 456.78 %
*/
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] = 1234.5678
      Console.WriteLine(myInt.ToString("P", nfi))
      ' Displays the same value with a blank as the separator.
      nfi.PercentGroupSeparator = " "
      Console.WriteLine(myInt.ToString("P", nfi))
   End Sub
End Class
'This code produces the following output.
'
'123,456.78 %
'123 456.78 %
	注解
属性 PercentGroupSeparator 与“P”标准格式字符串一起使用,以定义分隔整数组的符号。 有关详细信息,请参阅标准数值格式字符串。