Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting Charactors in a string

Status
Not open for further replies.

Dan688

Programmer
Dec 29, 2003
128
0
0
GB
Im trying to delete the first two charactors of a string that I have in string:

strInput

I was using strInput = Left(strInput,2)- Space (2) but thats a type mismatch!

Maybe simple but I cant see how!

Many Thanks,
 
Try this :

X= Len(StrInput)
strInput = Mid(strInput,2,X)
 
Or :
strInput = Right$(strInput, (len(strInput)-2)

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
And because I'm particularly tired and my mind is wandering, here is a effective but completely ridiculous solution:
Code:
Option Explicit

Private Type JustSilly
    NotWanted As String * 2
    RestOfString As String * 4096
End Type

Private Type Buffer
    Temp As String * 4098
End Type

Private Sub Command1_Click()
    Dim strSource As Buffer
    Dim strSpoon As JustSilly
    
    strSource.Temp = "Hello there"
    
    LSet strSpoon = strSource
    Debug.Print Trim(strSpoon.RestOfString)

End Sub
 
Ooooooooo, equivalencing - brings me back to my old Fortran days - wait a minute - I still use it (only when I have to!).

I guess no matter how many advancements are made in languages, some things never go away! ;-)

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top