|
-
Apr 16th, 2002, 10:58 AM
#1
Thread Starter
Addicted Member
Left() and right()
Sometimes i seem to be able to use them without problems but sometimes they don't work? Can anybody tell me what im doing wrong? thnx
-
Apr 16th, 2002, 11:27 AM
#2
well there is no left and right as part of the string class..you now have SubString with the parameters (startingposition, length)
if you want to get left 2 characters..you say
blah = thestring.Substring(0,2)
to get the right 2 characters of a string
blah = thestring.SubString(thestring.length - 2,2)
left and right I believe are just part of the Microsoft.VisualBasic class which is there solely for some backwards comatability..I try to avoid it as you do everything you could do in VB with the new stuff the framework provides.
-
Apr 16th, 2002, 11:27 AM
#3
Two ways:
Left() = strString.SubString(0, length)
Right() = strString.SubString((strString.length - <how many characters from the right you want to return>))
you can also import the Microsoft.VisualBasic namespace and use the Left and Right functions.
-
Apr 16th, 2002, 11:30 AM
#4
boy are we ever on the same track..arent we Thelonius?
nearly the exact same answer
-
Apr 16th, 2002, 11:44 AM
#5
And posted within seconds of each other.
-
Apr 16th, 2002, 06:17 PM
#6
Thread Starter
Addicted Member
OK i found it out :-) thank you very much guys!
Last edited by JpEgy; Apr 16th, 2002 at 06:20 PM.
JpEgy
-
Apr 17th, 2002, 09:54 AM
#7
New Member
Another way you can do it from the way listed above is to do something similar to the following:
Dim test As String = Microsoft.VisualBasic.Left( str as string, length as Integer)
Dim test As String = Microsoft.VisualBasic.Right( str as string, length as Integer)
Dim test As String = Microsoft.VisualBasic.Mid(str as string, Start as Integer, Length as Integer)
Just providing another avenue of attack. Hope it helps
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|