"SfR Fresh" - the SfR Freeware/Shareware Archive 
As a special service "SfR Fresh" has tried to format the requested source page into HTML format using source code syntax highlighting with prefixed line numbers.
Alternatively you can here view or download the uninterpreted source code file.
That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
1 '
2 ' ####################
3 ' ##### PROLOG #####
4 ' ####################
5 '
6 PROGRAM "aconvert"
7 VERSION "0.0001"
8 '
9 '
10 ' convert a numeric string to any numeric datatype
11 ' convert any numeric datatype to a numeric string
12 '
13 '
14 DECLARE FUNCTION Entry ()
15 '
16 '
17 ' ######################
18 ' ##### Entry () #####
19 ' ######################
20 '
21 ' >
22 ' > In the absence of VAL() how do I change a string say "8" to a number,
23 ' > so that I can calculate with it.. I've looked in all the libraries and
24 ' > can find XstStringToNumber but I can't understand the input params.
25 ' > GetValue does not look right also.
26 ' > Regards
27 ' > Bob
28 '
29 ' It's so easy and natural and obvious, you just don't notice it! :-)
30 '
31 ' You will laugh, and wonder why QBasic and every language don't work this way.
32 '
33 ' No matter what data-type you want to convert to or from,
34 ' the only question is, what type do you want to convert to?
35 '
36 ' All the following are valid syntax, though some will cause overflow
37 ' errors (for example the range of SBYTE range is only -128 to +127 .
38 ' Those that cause overflow errors are commented out, but will work
39 ' given numeric strings within the range supported by the data-type.
40 '
41 '
42 FUNCTION Entry ()
43 '
44 ' create a variable of each datatype
45 '
46 SBYTE sbyte
47 UBYTE ubyte
48 SSHORT sshort
49 USHORT ushort
50 SLONG slong
51 ULONG ulong
52 XLONG xlong
53 SINGLE single
54 DOUBLE double
55 STRING string$
56 '
57 ' create strings with various numeric formats
58 '
59 a$ = "123"
60 b$ = "1234.5678"
61 c$ = "12.345678e2"
62 d$ = "1.2345678d3"
63 e$ = "0x1234ABCD"
64 f$ = "0o12345670"
65 g$ = "0b01100101"
66 '
67 sbyte = SBYTE (a$)
68 ' sbyte = SBYTE (b$)
69 ' sbyte = SBYTE (c$)
70 ' sbyte = SBYTE (d$)
71 ' sbyte = SBYTE (e$)
72 ' sbyte = SBYTE (f$)
73 sbyte = SBYTE (g$)
74 '
75 ubyte = UBYTE (a$)
76 ' ubyte = UBYTE (b$)
77 ' ubyte = UBYTE (c$)
78 ' ubyte = UBYTE (d$)
79 ' ubyte = UBYTE (e$)
80 ' ubyte = UBYTE (f$)
81 ubyte = UBYTE (g$)
82 '
83 sshort = SSHORT (a$)
84 sshort = SSHORT (b$)
85 sshort = SSHORT (c$)
86 sshort = SSHORT (d$)
87 ' sshort = SSHORT (e$)
88 ' sshort = SSHORT (f$)
89 sshort = SSHORT (g$)
90 '
91 ushort = USHORT (a$)
92 ushort = USHORT (b$)
93 ushort = USHORT (c$)
94 ushort = USHORT (d$)
95 ' ushort = USHORT (e$)
96 ' ushort = USHORT (f$)
97 ushort = USHORT (g$)
98 '
99 slong = SLONG (a$)
100 slong = SLONG (b$)
101 slong = SLONG (c$)
102 slong = SLONG (d$)
103 slong = SLONG (e$)
104 slong = SLONG (f$)
105 slong = SLONG (g$)
106 '
107 ulong = ULONG (a$)
108 ulong = ULONG (b$)
109 ulong = ULONG (c$)
110 ulong = ULONG (d$)
111 ulong = ULONG (e$)
112 ulong = ULONG (f$)
113 ulong = ULONG (g$)
114 '
115 xlong = XLONG (a$)
116 xlong = XLONG (b$)
117 xlong = XLONG (c$)
118 xlong = XLONG (d$)
119 xlong = XLONG (e$)
120 xlong = XLONG (f$)
121 xlong = XLONG (g$)
122 '
123 single = SINGLE (a$)
124 single = SINGLE (b$)
125 single = SINGLE (c$)
126 single = SINGLE (d$)
127 single = SINGLE (e$)
128 single = SINGLE (f$)
129 single = SINGLE (g$)
130 '
131 double = DOUBLE (a$)
132 double = DOUBLE (b$)
133 double = DOUBLE (c$)
134 double = DOUBLE (d$)
135 double = DOUBLE (e$)
136 double = DOUBLE (f$)
137 double = DOUBLE (g$)
138 '
139 ' converting to a string is just as easy
140 ' and obvious as converting from a string
141 '
142 string$ = STRING$ (sbyte)
143 string$ = STRING$ (ubyte)
144 string$ = STRING$ (sshort)
145 string$ = STRING$ (ushort)
146 string$ = STRING$ (slong)
147 string$ = STRING$ (ulong)
148 string$ = STRING$ (xlong)
149 string$ = STRING$ (single)
150 string$ = STRING$ (double)
151 END FUNCTION
152 END PROGRAM