Tilted Forum Project Discussion Community

Tilted Forum Project Discussion Community (https://thetfp.com/tfp/)
-   Tilted Technology (https://thetfp.com/tfp/tilted-technology/)
-   -   [VBScript] Parsing a string for number (https://thetfp.com/tfp/tilted-technology/48407-vbscript-parsing-string-number.html)

furious 03-09-2004 07:40 AM

[VBScript] Parsing a string for number
 
Ok its late here and im having a retard moment.

In Javascript there is the parseInt function which returns a number from a string.

eg: aString = "hi im 18 years old" using parseInt would give me 18

Is there a similar thing in VBScript of taking a integer/double etc from a string?

Thanks to anyone who took time to view this...

mgcloud 03-09-2004 10:33 PM

You can try using CInt("18") - I'm not 100% sure if it'll work/extract the nubmer from the string though.

wondash 03-12-2004 05:25 AM

There's no equivalent in vbscript. You could use the Split function to separate the sentence into words, then loop through the array and use the IsNumeric function on each word.

furious 03-14-2004 06:55 PM

Nice one!

I knew i had done it somehow before.... and using the split then isNumeric method was the way i did it!@

I think this could very well be a definitive sign that partying does kill the brain cells.

Thanks wondash.

SaltPork 03-17-2004 02:42 PM

Quote:

Originally posted by mgcloud
You can try using CInt("18") - I'm not 100% sure if it'll work/extract the nubmer from the string though.
doesn't that only convert a string to an integer? I think that would fail.


All times are GMT -8. The time now is 11:43 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73