string function

 This is All about String in Visual Basic. just Copy Paste to new Form and Learn How to manipulate Strings
--------------------------------------------
Private Sub cmdTryIt_Click()

          Dim strTest As String
         strTest = InputBox("Please enter a string:")      
          Print "Using Len:"; Tab(25); Len(strTest)
          Print "Using Mid$:"; Tab(25); Mid$(strTest, 3, 4)
          Print "Using Left$:"; Tab(25); Left$(strTest, 3)
          Print "Using Right$:"; Tab(25); Right$(strTest, 2)
          Print "Using UCase$:"; Tab(25); UCase$(strTest)
          Print "Using LCase$:"; Tab(25); LCase$(strTest)
          Print "Using Instr:"; Tab(25); InStr(strTest, "a")
          Print "Gua nih "; Tab(25); InStrRev(strTest, ",")
          Print "nyari space terakhir "; Tab(25); lngPos = InStrRev(strTest, Chr(32))
          Print "Using InstrRev:"; Tab(25); InStrRev(strTest, "a")

          Print "Using LTrim$:"; Tab(25); LTrim$(strTest)

          Print "Using RTrim$:"; Tab(25); RTrim$(strTest)

          Print "Using Trim$:"; Tab(25); Trim$(strTest)

          Print "Using String$ & Space$:"; Tab(25); String$(3, "*") & _
               Space$(2) & _
              Trim$(strTest) & _
           Space$(2) & _
             String$(3, 42)

          Print "Using Replace$:"; Tab(25); Replace$(strTest, "a", "*")

          Print "Using StrReverse$:"; Tab(25); StrReverse$(strTest)

          Print "Using Asc:"; Tab(25); Asc(strTest)
           
      End Sub
TRANSLATE this Page

Posting Komentar

0 Komentar