当前位置: 首页>>代码示例>>VB.NET>>正文


VB.NET IdnMapping.UseStd3AsciiRules属性代码示例

本文整理汇总了VB.NET中System.Globalization.IdnMapping.UseStd3AsciiRules属性的典型用法代码示例。如果您正苦于以下问题:VB.NET IdnMapping.UseStd3AsciiRules属性的具体用法?VB.NET IdnMapping.UseStd3AsciiRules怎么用?VB.NET IdnMapping.UseStd3AsciiRules使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在System.Globalization.IdnMapping的用法示例。


在下文中一共展示了IdnMapping.UseStd3AsciiRules属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。

示例1: Example

' 导入命名空间
Imports System.Globalization

Module Example
   Public Sub Main()
      Dim nFailed As Integer = 0
      Dim idnStd As New IdnMapping()
      idnStd.UseStd3AsciiRules = True
      
      Dim idnRelaxed As New IdnMapping
      idnRelaxed.UseStd3AsciiRules = False     ' The default, but make it explicit.
      
      For ctr As Integer = 0 To &h7F 
         Dim name As String = "Prose" + ChrW(ctr) + "ware.com"
         
         Dim stdFailed As Boolean = False
         Dim relaxedFailed As Boolean = False
         Dim punyCode As String
         Try
            punyCode = idnStd.GetAscii(name)
         Catch e As ArgumentException
            stdFailed = True
         End Try       
         
         Try
            punyCode = idnRelaxed.GetAscii(name)
         Catch e As ArgumentException
            relaxedFailed = True
         End Try       
         
         If relaxedFailed <> stdFailed Then
            Console.Write("U+{0:X4}     ", ctr)
            nFailed += 1
            If nFailed Mod 5 = 0 Then Console.WriteLine()         
         End If 
      Next   
   End Sub
End Module
开发者ID:VB.NET开发者,项目名称:System.Globalization,代码行数:38,代码来源:IdnMapping.UseStd3AsciiRules

输出:

U+0020     U+0021     U+0022     U+0023     U+0024
U+0025     U+0026     U+0027     U+0028     U+0029
U+002A     U+002B     U+002C     U+002F     U+003A
U+003B     U+003C     U+003D     U+003E     U+003F
U+0040     U+005B     U+005C     U+005D     U+005E
U+005F     U+0060     U+007B     U+007C     U+007D
U+007E


注:本文中的System.Globalization.IdnMapping.UseStd3AsciiRules属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。