CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: Override method

Threaded View

  1. #2
    Join Date
    Oct 2006
    Posts
    327

    Re: Override method

    Hello,

    Something like that ?

    Code:
    Dim origstring As String, titi() As Byte, translated As String, i As Integer
    origstring = "ABC DEFGHIJKLMNOPQRSTUVWXYZDC"
    titi = StrConv(origstring, vbFromUnicode)
    translated = ""
    For i = 0 To UBound(titi)
      If Chr(titi(i)) Like "[A-Z]" Then
        translated = translated & Chr(90 - titi(i) + 65)
      Else
        translated = translated & Chr(titi(i))
      End If
    Next
    MsgBox translated
    which could of course be written that way too (might be a bit faster)

    Code:
    Dim origstring As String, titi() As Byte, translated As String, i As Integer
    origstring = "ABC DEFGHIJKLMNOPQRSTUVWXYZDC"
    titi = StrConv(origstring, vbFromUnicode)
    translated = ""
    For i = 0 To UBound(titi)
      Select Case titi(i)
        Case 65 To 90
          translated = translated & Chr(90 - titi(i) + 65)
        Case Else
          translated = translated & Chr(titi(i))
        End Select
      Next
    MsgBox translated
    Last edited by moa; January 19th, 2010 at 04:36 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured