Onur,
The first I agree, it is converting the P in the middle as well, to lower.
But how can you convert a string with a P in the middle to a what you call a
numeric?
That can only by those who call a string with all numeric characters a
numeric, and therefore I did not extend the code for that part.
(By the way, I have tried the code, with that what you did, you can do the
same, as you then set a simple Cint before it, you can use it as any real
numeric value instead of a string, however this can in my idea never been
done in the way the Op was asking).
Cor
"kimiraikkonen" <ki*************@gmail.comschreef in bericht
news:10**********************************@x41g2000 hsb.googlegroups.com...
On Sep 29, 2:06 pm, "Cor Ligthert [MVP]" <notmyfirstn...@planet.nl>
wrote:
Tee,
dim Example as string = "P50001p".tolower.Trim("p")
http://msdn.microsoft.com/en-us/library/d4tt83f9.aspx
Cor
"engteng" <pass...@gmail.comschreef in
berichtnews:eH**************@TK2MSFTNGP03.phx.gbl. ..
How do I convert string to numeric in VB.NET 2003 ?
Example convert P50001 to 50001 or 50001P to 50001 but if P is in middle
then not convert.
Regards,
Tee- Hide quoted text -
- Show quoted text -
Why are you trying to lower P? OP just wants to convert "P50001 to
50001" or "50001P to 50001". Plus, trimming 'P' is not enough alone,
also the string type must be converted to a numeric type such as
Integer for further usage. In this case, it's proper to take the part
of the string value that can be casted to Integer using CInt or
Convert.ToInt32 etc. (without 'P').
Thanks,
Onur G.