VB.Net/Development/StringInfo

Материал из VB Эксперт
Перейти к: навигация, поиск

Localization StringInfo

  
Imports System.Globalization
Module Module1
   Sub Main()
      Dim MyStr, OutBuf As String
      Dim Iter As TextElementEnumerator
      MyStr = "this is a test"
      Iter = StringInfo.GetTextElementEnumerator(MyStr)
      Do While (Iter.MoveNext)
         OutBuf = "Character at position " + Iter.ElementIndex.ToString() + " = " + Iter.Current
         Console.WriteLine(OutBuf)
      Loop
      Dim k As Int16
      For k = 0 To Len(MyStr) - 1
         OutBuf = "Character at position " + k.ToString + " = " + StringInfo.GetNextTextElement(MyStr, k)
         Console.WriteLine(OutBuf)
      Next
      Dim j As Int16
      For j = 1 To Len(MyStr)
         OutBuf = "Character at position " + j.ToString + " = " + Mid(MyStr, j, 1)
         Console.WriteLine(OutBuf)
      Next
   End Sub
End Module