|
-
Jan 22nd, 2007, 03:44 PM
#1
Thread Starter
Member
Re: Removing characters from a string?
 Originally Posted by DRI66
Hello,
This is what you need
VB Code:
Dim MyStr As String
MyStr = Left("Xyzaaa1234567", 6)
Best Regards,
Didier.
The problem with this is that it extracts the first 6 letters. In my program only the last 7 letters are CONSTANT and I need to remove that constant letters.
-
Jan 22nd, 2007, 03:52 PM
#2
Re: Removing characters from a string?
Have you tried what I posted, vert?
-
Jan 22nd, 2007, 03:53 PM
#3
PowerPoster
Re: Removing characters from a string?
 Originally Posted by vert
The problem with this is that it extracts the first 6 letters. In my program only the last 7 letters are CONSTANT and I need to remove that constant letters.
Actually, left() reduces the string to only its leftmost characters...the left characters will be retained and the rest removed.
However, how about you give us something to work with here...The stuff you're trying to remove, is it ALWAYS the same text, is it ALWAYS numbers, is it ALWAYS letters? If it's always the same, you can use a very simple replace() function to remove it, if it's always letters or numbers you can use a modified function (one that uses replace()) that can remove them :-)
Well, everyone else has been doing it :-)
Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
Expect more to come in future
If I have helped you, RATE ME! :-)
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.
-
Jan 22nd, 2007, 04:20 PM
#4
Thread Starter
Member
Re: Removing characters from a string?
 Originally Posted by smUX
Actually, left() reduces the string to only its leftmost characters...the left characters will be retained and the rest removed.
However, how about you give us something to work with here...The stuff you're trying to remove, is it ALWAYS the same text, is it ALWAYS numbers, is it ALWAYS letters? If it's always the same, you can use a very simple replace() function to remove it, if it's always letters or numbers you can use a modified function (one that uses replace()) that can remove them :-)
Example:
1) michaelA12345P1
2) johnC12345P2
I want to retain the michaelA and johnC.
-
Jan 22nd, 2007, 03:54 PM
#5
Re: Removing characters from a string?
Then you can use the Left$() or Mid$() functions like Rhino posted.
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
|