blob: ff74db48e0a9c863a8936d0221a4211b8234a61f (
plain)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
|
<?xml version="1.0" encoding="UTF-8"?>
<helpdocument version="1.0">
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<meta>
<topic id="textsbasicshared03103600xml" indexer="include" status="PUBLISH">
<title id="tit" xml-lang="en-US">TypeName Function; VarType Function</title>
<filename>/text/sbasic/shared/03103600.xhp</filename>
</topic>
</meta>
<body>
<section id="typename">
<bookmark xml-lang="en-US" branch="index" id="bm_id3143267">
<bookmark_value>TypeName function</bookmark_value>
<bookmark_value>VarType function</bookmark_value>
</bookmark>
<paragraph id="hd_id3143267" role="heading" level="1" xml-lang="en-US"><link href="text/sbasic/shared/03103600.xhp" name="TypeName Function; VarType Function">TypeName Function; VarType Function</link></paragraph>
<paragraph id="par_id3159157" role="paragraph" xml-lang="en-US">Returns a string (TypeName) or a numeric value (VarType) that contains information for a variable.</paragraph>
</section>
<paragraph id="hd_id3153825" role="heading" level="2" xml-lang="en-US">Syntax:</paragraph>
<bascode>
<paragraph id="par_id3155341" role="bascode" xml-lang="en-US">TypeName (Variable) / VarType (Variable)</paragraph>
</bascode>
<paragraph id="hd_id3145610" role="heading" level="2" xml-lang="en-US">Return value:</paragraph>
<paragraph id="par_id3148947" role="paragraph" xml-lang="en-US">String; Integer</paragraph>
<paragraph id="hd_id3146795" role="heading" level="2" xml-lang="en-US">Parameters:</paragraph>
<paragraph id="par_id3148664" role="paragraph" xml-lang="en-US"> <emph>Variable:</emph> The variable that you want to determine the type of. You can use the following values:</paragraph>
<table id="tbl_id3153362">
<tablerow>
<tablecell>
<paragraph id="par_id3145171" role="tablehead" xml-lang="en-US">key word</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id051620170608269696" role="tablehead" xml-lang="en-US">Named constant </paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3156212" role="tablehead" xml-lang="en-US">VarType</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3154684" role="tablehead" xml-lang="en-US">Variable type</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph id="par_id3151041" role="paragraph" localize="false" xml-lang="en-US">Boolean</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id051620170609229026" role="paragraph" localize="false" xml-lang="en-US"> </paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3153367" role="paragraph" localize="false" xml-lang="en-US">11</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3148645" role="paragraph" xml-lang="en-US">Boolean variable</paragraph>
</tablecell>
</tablerow> <tablerow>
<tablecell>
<paragraph id="par_id3151042" role="paragraph" localize="false" xml-lang="en-US">Byte</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id061620170609229026" role="paragraph" localize="false" xml-lang="en-US"> </paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3253367" role="paragraph" localize="false" xml-lang="en-US">17</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3158645" role="paragraph" xml-lang="en-US">Byte variable</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph id="par_id3153138" role="paragraph" localize="false" xml-lang="en-US">Date</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id051620170608329367" role="paragraph" localize="false" xml-lang="en-US">V_DATE</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3153363" role="paragraph" localize="false" xml-lang="en-US">7</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3155411" role="paragraph" xml-lang="en-US">Date variable</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph id="par_id051620170608331783" role="paragraph" localize="false" xml-lang="en-US">Currency</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id051620170608333476" role="paragraph" localize="false" xml-lang="en-US">V_CURRENCY</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id051620170608333808" role="paragraph" localize="false" xml-lang="en-US">6</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id051620170608331416" role="paragraph" xml-lang="en-US">Currency variable</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph id="par_id3146975" role="paragraph" localize="false" xml-lang="en-US">Double</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id051620170608337319" role="paragraph" localize="false" xml-lang="en-US">V_DOUBLE</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3150486" role="paragraph" localize="false" xml-lang="en-US">5</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3148616" role="paragraph" xml-lang="en-US">Double floating point variable</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph id="par_id3148457" role="paragraph" localize="false" xml-lang="en-US">Integer</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id05162017060833922" role="paragraph" localize="false" xml-lang="en-US">V_INTEGER</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3145647" role="paragraph" localize="false" xml-lang="en-US">2</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3154490" role="paragraph" xml-lang="en-US">Integer variable</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph id="par_id3149960" role="paragraph" localize="false" xml-lang="en-US">Long</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id051620170608332124" role="paragraph" localize="false" xml-lang="en-US">V_LONG</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3154513" role="paragraph" localize="false" xml-lang="en-US">3</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3151318" role="paragraph" xml-lang="en-US">Long integer variable</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph id="par_id3146972" role="paragraph" localize="false" xml-lang="en-US">Object</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id051620170609224777" role="paragraph" localize="false" xml-lang="en-US"> </paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3154482" role="paragraph" localize="false" xml-lang="en-US">9</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3150323" role="paragraph" xml-lang="en-US">Object variable</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph id="par_id3148405" role="paragraph" localize="false" xml-lang="en-US">Single</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id051620170608337392" role="paragraph" localize="false" xml-lang="en-US">V_SINGLE</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3149020" role="paragraph" localize="false" xml-lang="en-US">4</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3147341" role="paragraph" xml-lang="en-US">Single floating-point variable</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph id="par_id3155901" role="paragraph" localize="false" xml-lang="en-US">String</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id05162017060833587" role="paragraph" localize="false" xml-lang="en-US">V_STRING</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3155960" role="paragraph" localize="false" xml-lang="en-US">8</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3146313" role="paragraph" xml-lang="en-US">String variable</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph id="par_id3145149" role="paragraph" localize="false" xml-lang="en-US">Variant</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id051620170609222468" role="paragraph" localize="false" xml-lang="en-US"> </paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3154021" role="paragraph" localize="false" xml-lang="en-US">12</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3145789" role="paragraph" xml-lang="en-US">Variant variable (can contain all types specified by the definition)</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph id="par_id3148630" role="paragraph" localize="false" xml-lang="en-US">Empty</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id051620170608331395" role="paragraph" localize="false" xml-lang="en-US">V_EMPTY</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3152584" role="paragraph" localize="false" xml-lang="en-US">0</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3151278" role="paragraph" xml-lang="en-US">Variable is not initialized</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
<paragraph id="par_id3154576" role="paragraph" localize="false" xml-lang="en-US">Null</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id05162017060833692" role="paragraph" localize="false" xml-lang="en-US">V_NULL</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3166424" role="paragraph" localize="false" xml-lang="en-US">1</paragraph>
</tablecell>
<tablecell>
<paragraph id="par_id3145131" role="paragraph" xml-lang="en-US">No valid data</paragraph>
</tablecell>
</tablerow>
</table>
<embed href="text/sbasic/shared/00000003.xhp#errorcode"/>
<embed href="text/sbasic/shared/00000003.xhp#err5"/>
<paragraph id="hd_id3149338" role="heading" level="2" xml-lang="en-US">Example:</paragraph>
<bascode>
<paragraph id="par_idm1340870000" role="bascode" localize="false" xml-lang="en-US">Sub ExampleType</paragraph>
<paragraph id="par_idm1340868768" role="bascode" localize="false" xml-lang="en-US">Dim iVar As Integer</paragraph>
<paragraph id="par_idm1340867536" role="bascode" localize="false" xml-lang="en-US">Dim sVar As String</paragraph>
<paragraph id="par_idm1340866304" role="bascode" localize="false" xml-lang="en-US">Dim siVar As Single</paragraph>
<paragraph id="par_idm1340865072" role="bascode" localize="false" xml-lang="en-US">Dim dVar As Double</paragraph>
<paragraph id="par_idm1340863840" role="bascode" localize="false" xml-lang="en-US">Dim bVar As Boolean</paragraph>
<paragraph id="par_idm1340862608" role="bascode" localize="false" xml-lang="en-US">Dim lVar As Long</paragraph>
<paragraph id="par_id051620170608333887" role="bascode" localize="false" xml-lang="en-US">Dim cVar as Currency</paragraph>
<paragraph id="par_id051620170608333925" role="bascode" localize="false" xml-lang="en-US">Dim tVar as Date</paragraph>
<paragraph id="par_idm1340861376" role="bascode" localize="false" xml-lang="en-US"> MsgBox TypeName(iVar) & " " & VarType(iVar) & Chr(13) &_</paragraph>
<paragraph id="par_idm1340860032" role="bascode" localize="false" xml-lang="en-US"> TypeName(sVar) & " " & VarType(sVar) & Chr(13) &_</paragraph>
<paragraph id="par_idm1340858736" role="bascode" localize="false" xml-lang="en-US"> TypeName(siVar) & " " & VarType(siVar) & Chr(13) &_</paragraph>
<paragraph id="par_idm1340857424" role="bascode" localize="false" xml-lang="en-US"> TypeName(dVar) & " " & VarType(dVar) & Chr(13) &_</paragraph>
<paragraph id="par_idm1340856128" role="bascode" localize="false" xml-lang="en-US"> TypeName(bVar) & " " & VarType(bVar) & Chr(13) &_</paragraph>
<paragraph id="par_id051620170608339345" role="bascode" localize="false" xml-lang="en-US"> TypeName(cVar) & " " & VarType(cVar) & Chr(13) &_</paragraph>
<paragraph id="par_id051620170608347372" role="bascode" localize="false" xml-lang="en-US"> TypeName(tVar) & " " & VarType(tVar) & Chr(13) &_</paragraph>
<paragraph id="par_id3148817" role="bascode" xml-lang="en-US"> TypeName(lVar) & " " & VarType(lVar),0,"Some types In $[officename] Basic"</paragraph>
<paragraph id="par_idm1340852896" role="bascode" localize="false" xml-lang="en-US">End Sub</paragraph>
</bascode>
</body>
</helpdocument>
|