replace a number in a string type to integer 
Author Message
 replace a number in a string type to integer

hi!
 I need a way to replace a number  in a string type to a integer
like I use the "str" function to replace a integer to string
I write the "int" function and it is not work ,so what can I use?
my code:
dim s as string
dim i as integer
s="1"
i=int(s)  'not replace it

Thank you
  M.R



Sat, 27 Apr 2002 03:00:00 GMT  
 replace a number in a string type to integer
Use i = CInt(s)

for Long, Boolean etc = Clng, CBool etc

Mark


Quote:
> hi!
>  I need a way to replace a number  in a string type to a integer
> like I use the "str" function to replace a integer to string
> I write the "int" function and it is not work ,so what can I use?
> my code:
> dim s as string
> dim i as integer
> s="1"
> i=int(s)  'not replace it

> Thank you
>   M.R



Sun, 28 Apr 2002 03:00:00 GMT  
 replace a number in a string type to integer
Unless I am mis-understanding your request, isn't it the Val function
that you are looking for?

dim s as string
dim I as integer
s = "1"
i = val(s)

Quote:

> hi!
>  I need a way to replace a number  in a string type to a integer
> like I use the "str" function to replace a integer to string
> I write the "int" function and it is not work ,so what can I use?
> my code:
> dim s as string
> dim i as integer
> s="1"
> i=int(s)  'not replace it

> Thank you
>   M.R



Sun, 28 Apr 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. string replace with wildcard number of spaces between strings - removing blank lines

2. Converting string to integer/number

3. Converting string to integer/number

4. change a string to an integer number

5. change a string to an integer number

6. change a string to an integer number

7. change a string to an integer number

8. Storing a 64Bits integer as a type compatible with MSAccess, but not string

9. Enum String Value (deriving from a Type Name and an Integer)

10. Replace and String.Replace only replaces first occurrence?

11. type mismatch - need to convert a passed-in string to a number

12. Find and Replace objects: Max len on the replace string

 

 
Powered by phpBB® Forum Software