If I input the string 2006-03894 from a file, how can I trim the string so that the result is 2006? Thank you, Ed
Left$() will work: VB Code: Debug.Print Left$("2006-03894", Instr(1, "2006-03894", "-") - 1)
Debug.Print Left$("2006-03894", Instr(1, "2006-03894", "-") - 1)
Microsoft MVP - Visual Basic 2006-2013 Why VB clears the clipboard on startup and how to avoid it? . Filtering Arrays . Save File To Database . Extract File From Database . Extract picture from database without using hard drive . Change Menu BackColor . How to use MS Flexgrid . Make Frame Transparent . The Easiest Way to Create an NT Service With VB6 . How to comment blocks of code in VB5 and VB6 . How to find and replace missing members of control array Visual Basic 6.0 On-Line Documentation . Connection Strings
so will split DIm tmp() as string tmp = Split("2006-03894", "-") Msgbox tmp(0)
JPnyc rocks!! (Just ask him!) If u have your answer please go to the thread tools and click "Mark Thread Resolved"
Originally Posted by RhinoBull Left$() will work: Bah! When will the symbols die?
My evil laugh has a squeak in it. kristopherwilson.com
In VB6 never! In case you never knew - there are two Left funtions: one return variant (Left) and one return string (Left$). Same for Mid/Mid$ and some others.
Forum Rules