all groups > dotnet academic > february 2005 >
You're in the

dotnet academic

group:

left(), mid(), right()


left(), mid(), right() JMorrell
2/13/2005 6:15:01 AM
dotnet academic: In VBA, there is a function to trim off a string, left(), mid(), and right().
I haven't found a similar function in VB.

Can someone help me out please? I'm trying to capture specific characters
in a string.

tia,
--
Re: left(), mid(), right() Peter van der Goes
2/13/2005 9:34:18 AM

[quoted text, click to view]

Assuming you're asking about Visual Basic .NET, the .NET Framework class
String includes the Trim(), TrimStart() and TrimEnd() methods that should
suffice. There are numerous other public methods included in the class that
may be helpful as well.
Search for the article "String class" in the help (category .NET Framework
Class Library).

--
Peter [MVP Visual Developer]
Jack of all trades, master of none.

Re: left(), mid(), right() JMorrell
2/13/2005 10:45:02 AM
Thanks for the quick reply. I actually found what I was looking for after
all.

Microsoft.VisualBasic.Left(string, n) give the first n characters of a string.

I used:

dim strLeft As String

strLeft = Microsoft.VisualBasic.Left(String, 2)

and was able to pare out the needed first 2 characters of my string.

This is Sunday, shouldn't you be off doing other things besides this? :)

Thanks again for your help.
JMorrell


[quoted text, click to view]
Re: left(), mid(), right() Peter van der Goes
2/13/2005 5:41:20 PM

[quoted text, click to view]
OK, but are you using Visual Basic .NET? I think what you've discovered is
part of the backward compatibility (to VB 6) library, whereas I was pointing
you at the .NET Framework class and methods applicable to String objects.
Personally, I'd opt to learn the .NET way as that's the future.
Sunday? The newsgroup thing isn't a job. More of a hobby.

--
Peter [MVP Visual Developer]
Jack of all trades, master of none.

Re: left(), mid(), right() Jay B. Harlow [MVP - Outlook]
2/13/2005 9:58:58 PM
Peter,
[quoted text, click to view]
Microsoft.VisualBasic is *NOT* part of the compatibility library. It is an
integral part of the VB.NET itself!

Microsoft.VisualBasic.Compatibility is the compatibility library.

I agree, learning .NET & VB.NET is the way to go. Microsoft.VisualBasic is
an integral part of VB.NET, so I recommend learning it and using it where &
when it makes sense.

Hope this helps
Jay


[quoted text, click to view]

Re: left(), mid(), right() Peter van der Goes
2/14/2005 6:45:58 AM

[quoted text, click to view]
Thank, Jay.
We both appreciate the correction.

AddThis Social Bookmark Button