Results 1 to 9 of 9

Thread: Quick1: strings

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Lowestoft
    Posts
    91

    Question

    Hey again,

    I have a string, and i want to chop the last two letters off the end, so is there a right() function? I cant remember, or do i use mid() or left()? if so, gimme an example pls.
    Mag-Net's Home
    Visual Studio 6-Enterprise - SP4
    ICQ: 35519773
    Have Fun

  2. #2
    Addicted Member
    Join Date
    Jul 1999
    Location
    St-Élie d'Orford, Quebec, Canada
    Posts
    133
    hi there...

    string1 = mid(string1,1,len(string1)-2)

  3. #3
    Addicted Member
    Join Date
    Apr 2000
    Location
    Sheffield, England.
    Posts
    136

    Another example

    Code:
    Dim A As String
    Dim B As String
    
    A = "Hello World!!"
    
    B = Left$(A, Len(A)-2)
    Visual Basic 6 Enterprise Edition + SP4

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Lowestoft
    Posts
    91

    another Q

    thanks, long time since i did nething with strings in vb, so tell me one more thing, how do i get the last two letters?
    Mag-Net's Home
    Visual Studio 6-Enterprise - SP4
    ICQ: 35519773
    Have Fun

  5. #5
    Addicted Member
    Join Date
    Apr 2000
    Location
    Sheffield, England.
    Posts
    136
    Code:
    Dim A As String
    Dim B As String
    
    A = "Hello World!!"
    
    B = Right$(A, 2)
    Visual Basic 6 Enterprise Edition + SP4

  6. #6
    Addicted Member
    Join Date
    Jul 1999
    Location
    St-Élie d'Orford, Quebec, Canada
    Posts
    133
    c'mon man...

    string1 = mid(string1,len(string1)-2,2)

  7. #7
    Hyperactive Member
    Join Date
    May 2000
    Posts
    367
    with a lead in the right direction of someone saying use mid, wouldnt be that hard to look it up in msdn to see how to utilize it. Sometimes is quicker than posting something.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Lowestoft
    Posts
    91
    Thanks to *Vince, gfk and billrogers. My head just isn't screwed on today, that is the trouble with having a free internet connection, you can just ask ppl, instead of using your head, thanks guys, but i really should get out of this habit!

    My MSDN doesnt work, it crashes everytime i try and view it under win98, hh.exe is what it crashes in. Works fine under NT tho

    [Edited by Mag-Net on 07-28-2000 at 11:43 AM]
    Mag-Net's Home
    Visual Studio 6-Enterprise - SP4
    ICQ: 35519773
    Have Fun

  9. #9
    Addicted Member
    Join Date
    Jul 1999
    Location
    St-Élie d'Orford, Quebec, Canada
    Posts
    133
    Just a little word of advice...

    " Asking is good and helpfull but remembering is better and usefull !!! "

    see you next time Mag-Net...

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