Results 1 to 4 of 4

Thread: VB : How can I make the use String functions

  1. #1
    Join Date
    Jan 2010
    Posts
    19

    VB : How can I make the use String functions

    Hello friends!, How are you? I just started learning the Visual Basic 6.0. So i don't know more about the this language. So I had to submit the assignment on the String Functions in college. And I want to know about what are the string functions and how they can work. I also want to know about the how they can be used in VB programs. So anyone know about the string functions and can anyone help me?
    Last edited by Fielder; 19-01-2010 at 12:31 PM.

  2. #2
    Join Date
    May 2008
    Posts
    2,389

    Visual Basic

    Hi, Visual Basic has number of built-in string functions for processing strings. In VB, most of the string functions return a string and some return a number such as the Len function that returns the length of the string, Instr and InstrRev functions that returns the character position within the string. The functions that returns strings can be coded with or without the dollar sign ($) at the end, although it is more efficient to use with the dollar sign. Hope it will help you.
    Last edited by opaper; 19-01-2010 at 12:44 PM.

  3. #3
    Join Date
    Jan 2008
    Posts
    1,521

    String functions

    I suggest you to look out the following list of the string functions. They are as follows:
    1. Len(string)
    2. Mid$(string, start[, length])
    3. Left$(string, length)
    4. Right$(string, length)
    5. UCase$(string)
    6. LCase$(string)$(string)
    7. InStr([start,] string1, string2 [, compare])
    8. InStrRev(string1, string2[, start, [, compare]])
    9. String$(number, character)
    10. Space$(number)
    11. Replace$(expression, find, replacewith[, start[, count[, compare]]])
    12. StrReverse$(string)
    13. LTrim$(string)
    14. RTrim$(string)
    15. Trim$(string)
    16. Asc(string)
    17. Chr$(charcode)
    The above all functions makes you to perform the string operations easily.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    OMFG String functions:Progaram

    According to my opinion the following program demonstrates you the functionality of all the string functions. Write the following code in the click event of command button:

    1. Private Sub cmd_Click()
    2. Dim strTst As String
    3. strTest = InputBox("Please enter a string:")
    4. Print "Using Len:"; Tab(25); Len(strTst)
    5. Print "Using Mid$:"; Tab(25); Mid$(strTst, 3, 4)
    6. Print "Using Left$:"; Tab(25); Left$(strTst, 3)
    7. Print "Using Right$:"; Tab(25); Right$(strTst, 2)
    8. Print "Using UCase$:"; Tab(25); UCase$(strTst)
    9. Print "Using LCase$:"; Tab(25); LCase$(strTst)
    10. Print "Using Instr:"; Tab(25); InStr(strTst, "a")
    11. Print "Using InstrRev:"; Tab(25); InStrRev(strTst, "a")
    12. Print "Using LTrim$:"; Tab(25); LTrim$(strTst)
    13. Print "Using RTrim$:"; Tab(25); RTrim$(strTst)
    14. Print "Using Trim$:"; Tab(25); Trim$(strTst)
    15. Print "Using String$ & Space$:"; Tab(25); String$(3, "*") _
    16. & Space$(2) _
    17. & Trim$(strTst) _
    18. & Space$(2) _
    19. & String$(3, 42)
    20. Print "Using Replace$:"; Tab(25); Replace$(strTst, "a", "*")
    21. Print "Using StrReverse$:"; Tab(25); StrReverse$(strTst)
    22. Print "Using Asc:"; Tab(25); Asc(strTst)
    23. End Sub

    Good Day!

Similar Threads

  1. Replies: 2
    Last Post: 27-02-2012, 03:56 PM
  2. How to Manipulate String using PHP String Functions
    By ComPaCt in forum Software Development
    Replies: 3
    Last Post: 21-09-2009, 09:07 AM
  3. How to call a C functions within PHP?
    By Rixwel in forum Software Development
    Replies: 3
    Last Post: 05-09-2009, 09:12 AM
  4. Functions in PHP
    By Gyan Guru in forum Guides & Tutorials
    Replies: 3
    Last Post: 13-12-2008, 06:20 PM
  5. Difference between capacity and size functions of string class
    By DimitrisLiatsos in forum Software Development
    Replies: 5
    Last Post: 25-10-2008, 05:07 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,011,691.98319 seconds with 17 queries