Before you can say it, I'll say it for you. I'm old.
<smiles>
I lament the loss of the LEFT function in VB. SUBSTRING is not the same, because it errors if you specify a length longer then the string.
Oh, I know you can code around that with LENGTH. And, I know that LEFT is still available, but you have to fully reference Microsoft.VisualBasic.Left() in order to use it.
That that makes me old, cranky, and lazy. <huge smile>
My answer is this: I include the code below in all my projects as part of the library that I import. It's my helper class for strings.
This class makes LEFT available for string objects, use it like this:
Dim
str
As
String
=
"12345"
Debug.WriteLine(str.Left(33))
Debug.WriteLine(str.Left(3))
and you'll get these results:
12345
123
If you're not familiar with extension classes, they work on the object type specified in the first parameter. So, in our code below, the first parameter ('theString') is a STRING type so this object extends the STRING class, and only uses one parameter (LENGTH)