summaryrefslogtreecommitdiffstats
path: root/helpcontent2/source/text/sbasic/shared/strconv.xhp
blob: e00a005e0fc32df54ed0c2429ac5d3a27dfcaee7 (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
<?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/.
 *
-->
<meta>
  <topic id="strconvvbafunc" indexer="include" status="PUBLISH">
    <title id="tit" xml-lang="en-US">StrConv Function [VBA]</title>
    <filename>/text/sbasic/shared/strconv.xhp</filename>
  </topic>
</meta>
<body>
<bookmark xml-lang="en-US" branch="index" id="bm_id941622761814292">
<bookmark_value>StrConv function</bookmark_value>
</bookmark>
<section id="vbastrconv">
    <h1 id="hd_id791622761498015"><link href="text/sbasic/shared/strconv.xhp" name="StrConv Function">StrConv Function</link></h1>
    <paragraph id="par_id621622761498018" role="paragraph" xml-lang="en-US"><variable id="variable name">Convert a string as specified by a conversion type.</variable></paragraph>
</section>
<embed href="text/sbasic/shared/00000003.xhp#vbasupport"/>
<embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
<paragraph role="code" id="par_id771622762489917">StrConv(Text, Conversion, [ LCID ])</paragraph>
<embed href="text/sbasic/shared/00000003.xhp#functvalue"/>
<paragraph role="paragraph" id="par_id971548420129767" localize="false">String</paragraph>
<embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
<paragraph role="paragraph" id="par_id421622762822934"><emph>Text</emph>: Any valid string expression.</paragraph>
<paragraph role="paragraph" id="par_id671622762931475"><emph>Conversion</emph>: The type of conversion to perform, as defined in the table below.</paragraph>
<section id="StrConv_constants">
<table id="tab_id91622763145456">
    <tablerow>
        <tablecell>
            <paragraph id="par_id531622763145456" role="tablehead">Conversion</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id131622763145457" role="tablehead">Value</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id411622763145457" role="tablehead">Description</paragraph>
        </tablecell>
    </tablerow>
    <tablerow>
        <tablecell>
            <paragraph id="par_id721622763145457" role="tablecontent" localize="false">vbUpperCase</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id11622763145458" role="tablecontent" localize="false">1</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id421622763145458" role="tablecontent">Converts <emph>Text</emph> characters to uppercase.</paragraph>
        </tablecell>
    </tablerow>
        <tablerow>
        <tablecell>
            <paragraph id="par_id91622763415122" role="tablecontent" localize="false">vbLowerCase</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id911622763415123" role="tablecontent" localize="false">2</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id251622763427976" role="tablecontent" xml-lang="en-US">Converts <emph>Text</emph> characters lowercase.</paragraph>
        </tablecell>
    </tablerow>
        <tablerow>
        <tablecell>
            <paragraph id="par_id1001622764064614" role="tablecontent" localize="false">vbProperCase</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id21622764064614" role="tablecontent" localize="false">3</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id531622764070154" role="tablecontent" xml-lang="en-US">Converts the first letter of every word in <emph>Text</emph> to uppercase.</paragraph>
        </tablecell>
    </tablerow>
        <tablerow>
        <tablecell>
            <paragraph id="par_id891622764187452" role="tablecontent" localize="false">vbWide</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id471622764187452" role="tablecontent" localize="false">4</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id881622764192628" role="tablecontent" xml-lang="en-US" >Converts narrow (<link href="text/shared/00/00000005.xhp#halfwidth" name="halfwidth">half-width</link>) characters in <emph>Text</emph> to wide (<link href="text/shared/00/00000005.xhp#halfwidth" name="halfwidth">full-width</link>) characters.</paragraph>
        </tablecell>
    </tablerow>
        <tablerow>
        <tablecell>
            <paragraph id="par_id121622764454098" role="tablecontent" localize="false">vbNarrow</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id31622764454099" role="tablecontent" localize="false">8</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id71622764459352" role="paragraph" xml-lang="en-US">Converts wide (<link href="text/shared/00/00000005.xhp#halfwidth" name="halfwidth">full-width</link>) characters in <emph>Text</emph> to narrow (<link href="text/shared/00/00000005.xhp#halfwidth" name="halfwidth">half-width</link>) characters.</paragraph>
        </tablecell>
    </tablerow>
        <tablerow>
        <tablecell>
            <paragraph id="par_id801622764558261" role="tablecontent" localize="false">vbKatakana</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id531622764558262" role="tablecontent" localize="false">16</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id371622764565366" role="tablecontent" xml-lang="en-US" >Converts Hiragana characters in <emph>Text</emph> to Katakana characters.</paragraph>
        </tablecell>
    </tablerow>
    <tablerow>
        <tablecell>
            <paragraph id="par_id771622764721149" role="tablecontent" localize="false">vbHiragana</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id901622764721150" role="tablecontent" localize="false">32</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id911622764728794" role="tablecontent" xml-lang="en-US">Converts Katakana characters in <emph>Text</emph> to Hiragana characters.</paragraph>
        </tablecell>
    </tablerow>
        <tablerow>
        <tablecell>
            <paragraph id="par_id211622764833771" role="tablecontent" localize="false">vbUnicode</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id321622764833772" role="tablecontent" localize="false">64</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id21622764841321" role="tablecontent" xml-lang="en-US">Converts <emph>Text</emph> characters to Unicode characters using the default code page of the system.</paragraph>
        </tablecell>
    </tablerow>
        <tablerow>
        <tablecell>
            <paragraph id="par_id901622764984846" role="tablecontent" localize="false">vbFromUnicode</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id281622764984846" role="tablecontent" localize="false">128</paragraph>
        </tablecell>
        <tablecell>
            <paragraph id="par_id221622764991492" role="tablecontent" xml-lang="en-US" >Converts <emph>Text</emph> characters from Unicode to the default code page of the system.</paragraph>
        </tablecell>
    </tablerow>
</table>
</section>
<paragraph role="paragraph" id="par_id761622765118156"><emph>LCID</emph> Optional. The Locale ID in decimal number. If this parameter is omitted, it assumes the system Locale ID. Refer to the file <link href="https://opengrok.libreoffice.org/xref/core/l10ntools/source/ulfconv/msi-encodinglist.txt" name="LCID">msi-encodinglist.txt</link> for the available LCID values.</paragraph>
<embed href="text/sbasic/shared/00000003.xhp#functexample"/>
<bascode>
<paragraph role="bascode" id="par_id321548420503855" xml-lang="en-US" localize="false">Option VBASupport 1</paragraph>
<paragraph role="bascode" id="par_id431548420514604" xml-lang="en-US" localize="false">Option Explicit</paragraph>
<paragraph role="bascode" id="par_id181548420522842" xml-lang="en-US" localize="false">Sub Test_StrConv</paragraph>
    <paragraph role="bascode" id="par_id251622770431375" xml-lang="en-US" localize="false">Print StrConv("abc EFG hij", vbUpperCase) '= "ABC EFG HIJ"</paragraph>
    <paragraph role="bascode" id="par_id321622770438020" xml-lang="en-US" localize="false">Print StrConv("abc EFG hij", vbLowerCase) ' =  "abc efg hij"</paragraph>
    <paragraph role="bascode" id="par_id271622770442247" xml-lang="en-US" localize="false">Print StrConv("abc EFG hij", vbProperCase) ' = "Abc Efg Hij"</paragraph>

    <paragraph role="bascode" id="par_id311622770486052" xml-lang="en-US">REM Converts narrow (single-byte) characters in string to wide</paragraph>
    <paragraph role="bascode" id="par_id31622770457020" xml-lang="en-US" localize="false">Print StrConv("ABCDEVB¥ì¥¹¥­¥å©", vbWide) ' = "ABCDEVB¥ì¥¹¥­¥å©"</paragraph>

    <paragraph role="bascode" id="par_id231622770493491" xml-lang="en-US">REM Converts wide (double-byte) characters in string to narrow (single-byte) characters</paragraph>
    <paragraph role="bascode" id="par_id371622770464200" xml-lang="en-US" localize="false">Print StrConv("ABCD@$%23'?EG", vbNarrow) ' = "ABCD@$%23'?EG"</paragraph>

    <paragraph role="bascode" id="par_id871622770498992" xml-lang="en-US">REM Converts Hiragana characters in string to Katakana characters</paragraph>
    <paragraph role="bascode" id="par_id291622770470204" xml-lang="en-US" localize="false">Print StrConv("かたかな", vbKatakana) ' = "カタカナ"</paragraph>

    <paragraph role="bascode" id="par_id351622770504087" xml-lang="en-US">REM Converts Katakana characters in string to Hiragana characters</paragraph>
    <paragraph role="bascode" id="par_id601622770474346" xml-lang="en-US" localize="false">Print StrConv("カタカナ", vbHiragana) '= "かたかな"</paragraph>

    <paragraph role="bascode" id="par_id861622770508875" xml-lang="en-US">REM  Assumes CP-1252 encoding associated with en-US locale used in unit tests.</paragraph>
    <paragraph role="bascode" id="par_id481622770521394" xml-lang="en-US" localize="false">Dim x() As Byte</paragraph>
    <paragraph role="bascode" id="par_id691622770750591" xml-lang="en-US" localize="false">x = StrConv("ÉϺ£ÊÐABC", vbFromUnicode)</paragraph>
    <paragraph role="bascode" id="par_id841622770962002" xml-lang="en-US">Print UBound(x) ' 8 characters</paragraph>
    <paragraph role="bascode" id="par_id931622770966903" xml-lang="en-US" localize="false">Print x(2) ' = 186</paragraph>
    <paragraph role="bascode" id="par_id91622770974484" xml-lang="en-US" localize="false">Print StrConv(x, vbUnicode)' = "ÉϺ£ÊÐABC"</paragraph>
<paragraph role="bascode" id="par_id121622772546703" xml-lang="en-US" localize="false">End Sub</paragraph>
</bascode>
<section id="relatedtopics">
    <embed href="text/sbasic/shared/special_vba_func.xhp#exclusivevba"/>
</section>
</body>
</helpdocument>