summaryrefslogtreecommitdiff
path: root/source/text/scalc/01/04060110.xhp
blob: fb03ee3956cb43084988c0f3309d87339f59cb75 (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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
<?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="textscalc0104060110xml" indexer="include">
    <title id="tit">Text Functions</title>
    <filename>/text/scalc/01/04060110.xhp</filename>
  </topic>
</meta>

<body>

<bookmark branch="index" id="bm_id3145389">
  <bookmark_value>text in cells; functions</bookmark_value>
  <bookmark_value>functions; text functions</bookmark_value>
  <bookmark_value>Function Wizard;text</bookmark_value>
</bookmark>


<h1 id="hd_id3145389"><variable id="head_text"><link href="text/scalc/01/04060110.xhp">Text Functions</link></variable></h1>
<paragraph id="par_id3152986" role="paragraph"><variable id="texttext">This section contains descriptions of the <emph>Text</emph> functions. </variable></paragraph>

<section id="howtoget">
<embed href="text/scalc/00/00000404.xhp#eikatext"/>
</section>

<section id="double_quotation_marks_in_formulas">
<bookmark branch="index" id="bm_id331624453577057">
  <bookmark_value>using double quotation marks in formulas</bookmark_value>
  <bookmark_value>formulas; using double quotation marks</bookmark_value>
</bookmark>

<h2 id="hd_id291624454173529">Using double quotation marks in formulas</h2>

<paragraph role="paragraph" id="par_id891624454058773">To include a text string in a formula, place the text string between two double quotation marks (") and Calc takes the characters in the string without attempting to interpret them. For example, the formula <input>="Hello world!"</input> displays the text string <literal>Hello world!</literal> in the cell, with no surrounding double quotation marks.</paragraph>

<paragraph role="paragraph" id="par_id461624454425320">The more complex formula <input>=CONCATENATE("Life is really simple, "; "but we insist on making it complicated "; "(Confucius).")</input> concatenates three individual strings in double quotation marks, outputting <literal>Life is really simple, but we insist on making it complicated (Confucius).</literal></paragraph>

<paragraph role="paragraph" id="par_id711624454477483">To place a literal double quotation mark within a string inside a formula, two methods can be used:</paragraph>

<list type="ordered">
    <listitem>
        <paragraph id="par_id541624454496424" role="listitem">You can "escape" the double quotation mark with an additional double quotation mark, and Calc treats the escaped double quotation mark as a literal value. For example, the formula <input>="My name is ""John Doe""."</input> outputs the string <literal>My name is "John Doe".</literal> Another simple example is the formula <input>=UNICODE("""")</input> which returns <literal>34</literal>, the decimal value of the Unicode quotation mark character (U+0022) — here the first and fourth double quotation marks indicate the beginning and end of the string, while the second double quotation mark escapes the third.</paragraph>
    </listitem>
    <listitem>
        <paragraph id="par_id21624454513641" role="listitem">You can use the CHAR function or the UNICHAR function to insert a double quotation mark. For example, the formula <input>=UNICHAR(34) &amp; "The Catcher in the Rye" &amp; UNICHAR(34) &amp; " is a famous book by J. D. Salinger."</input> displays the string <literal>"The Catcher in the Rye" is a famous book by J. D. Salinger.</literal></paragraph>
    </listitem>
</list>

<paragraph role="paragraph" id="par_id401624454547945">Be aware that Calc's AutoCorrect function may modify double quotation marks. AutoCorrect should not change the double quotation marks within formula cells but may change those used in non-formula cells containing text. For example, if you copy a string that is surrounded by some other form of typographical double quotation marks, such as the left double quotation mark (U+201C) and the right double quotation mark (U+201D), and then paste into a formula cell, an error may result. Open the <emph>Double Quotes</emph> area of the <menuitem>Tools - AutoCorrect Options - Localized Options</menuitem> dialog to set the characters used to automatically correct the start and end typographical double quotation marks. Uncheck the <menuitem>Replace</menuitem> toggle button to disable the feature.</paragraph>

</section>
<h2 id="hd_id451721571883016">Empty string and blank cells</h2>
<paragraph role="paragraph" id="par_id241721571890240"><variable id="stringblank">Cells with the empty string ("") are not equivalent to blank cells. When searching or calculating with text, the empty string "" is the text with length zero.</variable></paragraph>
<paragraph role="paragraph" id="par_id451721571895265">For example, when the formula in A1 returns the empty string "", the following applies:</paragraph>
<paragraph role="paragraph" id="par_id591721571900225"><input>=ISBLANK(A1)</input> returns FALSE. The cell is not blank.</paragraph>
<paragraph role="paragraph" id="par_id781721571904769"><input>=ISFORMULA(A1)</input> returns TRUE. The cell is a formula.</paragraph>
<paragraph role="paragraph" id="par_id671721571909081"><input>=ISLOGICAL(A1)</input> returns FALSE. Not a logical value.
</paragraph>
<paragraph role="paragraph" id="par_id791721571916704"><input>=ISNONTEXT(A1)</input> returns FALSE. The cell has the empty string.</paragraph>
<paragraph role="paragraph" id="par_id91721571920288"><input>=ISNUMBER(A1)</input> returns FALSE. Not a number.</paragraph>
<paragraph role="paragraph" id="par_id821721571924250"><input>=ISTEXT(A1)</input> returns TRUE. The cell has the empty string, calculated by a formula.</paragraph>
<paragraph role="paragraph" id="par_id71721571927654"><input>=LEN(A1)</input> returns 0. The length of the empty string is 0.</paragraph>


<sort order="asc" descendant="h2">

<section id="arabic">
  <embed href="text/scalc/01/func_arabic.xhp#func_arabic"/>
</section>

<section id="asc">
  <embed href="text/scalc/01/func_asc.xhp#func_asc"/>
</section>

<section id="bahttext">
  <embed href="text/scalc/01/func_bahttext.xhp#func_bahttext"/>
</section>

<section id="base">
  <embed href="text/scalc/01/func_base.xhp#func_base"/>
</section>

<section id="char"><embed href="text/scalc/01/func_char.xhp#func_char"/></section>

<section id="clean"><embed href="text/scalc/01/func_clean.xhp#func_clean"/></section>

<section id="code"><embed href="text/scalc/01/func_code.xhp#func_code"/></section>

<section id="concatenate"><embed href="text/scalc/01/func_concatenate.xhp#func_concatenate"/></section>

<section id="decimal"><embed href="text/scalc/01/func_decimal.xhp#func_decimal"/></section>

<section id="dollar"><embed href="text/scalc/01/func_dollar.xhp#func_dollar"/></section>

<section id="exact"><embed href="text/scalc/01/func_exact.xhp#func_exact"/></section>

<section id="find"><embed href="text/scalc/01/func_find.xhp#func_find"/></section>

<section id="fixed"><embed href="text/scalc/01/func_fixed.xhp#func_fixed"/></section>

<section id="jis">
  <embed href="text/scalc/01/func_jis.xhp#func_jis"/>
</section>

<section id="left"><embed href="text/scalc/01/func_left.xhp#func_left"/></section>

<section id="leftb">
<bookmark branch="index" id="bm_id2947083">
  <bookmark_value>LEFTB function</bookmark_value>
</bookmark>

<bookmark branch="hid/SC_HID_FUNC_LEFTB" id="bm_id2954645" localize="false"/>

<h2 id="hd_id2947083"><variable id="leftbvar"><link href="text/scalc/01/04060110.xhp#leftb">LEFTB</link></variable></h2>
<paragraph id="par_id2953622" role="paragraph"><ahelp hid="HID_FUNC_LEFTB">Returns the first characters of a DBCS text.</ahelp></paragraph>
<embed href="text/scalc/00/avail_release.xhp#4.2"/>
<embed href="text/scalc/01/common_func.xhp#sectionsyntax"/>
<paragraph id="par_id2946786" role="code">LEFTB("Text" [; Number_bytes])</paragraph>
<paragraph id="par_id2947274" role="paragraph"><emph>Text</emph> is the text where the initial partial words are to be determined.</paragraph>
<paragraph id="par_id2953152" role="paragraph"><emph>Number_bytes</emph> (optional) specifies the number of characters you want LEFTB to extract, based on bytes. If this parameter is not defined, one character is returned.</paragraph>

<embed href="text/scalc/01/common_func.xhp#sectionexample"/>
<paragraph id="par_id2949141" role="paragraph"><item type="input">=LEFTB("中国";1)</item> returns " " (1 byte is only half a DBCS character and a space character is returned instead).</paragraph>
<paragraph id="par_id2949151" role="paragraph"><item type="input">=LEFTB("中国";2)</item> returns "中" (2 bytes constitute one complete DBCS character).</paragraph>
<paragraph id="par_id2949161" role="paragraph"><item type="input">=LEFTB("中国";3)</item> returns "中 " (3 bytes constitute one DBCS character and a half; the last character returned is therefore a space character).</paragraph>
<paragraph id="par_id2949171" role="paragraph"><item type="input">=LEFTB("中国";4)</item> returns "中国" (4 bytes constitute two complete DBCS characters).</paragraph>
<paragraph id="par_id2949181" role="paragraph"><item type="input">=LEFTB("office";3)</item> returns "off" (3 non-DBCS characters each consisting of 1 byte).</paragraph>
</section>

<section id="len"><embed href="text/scalc/01/func_len.xhp#func_len"/></section>

<section id="lenb">
<bookmark branch="index" id="bm_id2956110">
  <bookmark_value>LENB function</bookmark_value>
</bookmark>

<bookmark branch="hid/SC_HID_FUNC_LENB" id="bm_id2954050" localize="false"/>

<h2 id="hd_id2956110"><variable id="lenbvar"><link href="text/scalc/01/04060110.xhp#lenb">LENB</link></variable></h2>
<paragraph id="par_id2950147" role="paragraph"><ahelp hid="HID_FUNC_LENB">For double-byte character set (DBCS) languages, returns the number of bytes used to represent the characters in a text string.</ahelp></paragraph>
<embed href="text/scalc/00/avail_release.xhp#4.2"/>
<embed href="text/scalc/01/common_func.xhp#sectionsyntax"/>
<paragraph id="par_id2954063" role="code">LENB("Text")</paragraph>
<paragraph id="par_id2946894" role="paragraph"><emph>Text</emph> is the text whose length is to be determined.</paragraph>

<embed href="text/scalc/01/common_func.xhp#sectionexample"/>
<paragraph id="par_id2956018" role="paragraph"><item type="input">LENB("中")</item> returns 2 (1 DBCS character consisting of 2 bytes).</paragraph>
<paragraph id="par_id2956028" role="paragraph"><item type="input">LENB("中国")</item> returns 4 (2 DBCS characters each consisting of 2 bytes).</paragraph>
<paragraph id="par_id2956038" role="paragraph"><item type="input">LENB("office")</item> returns 6 (6 non-DBCS characters each consisting of 1 byte).</paragraph>
<paragraph id="par_id2956008" role="paragraph"> <item type="input">=LENB("Good Afternoon")</item> returns 14.</paragraph>
<paragraph id="par_id2954300" role="paragraph"> <item type="input">=LENB(12345.67)</item> returns 8.</paragraph>
</section>

<section id="lower"><embed href="text/scalc/01/func_lower.xhp#func_lower"/></section>

<section id="mid">
<bookmark branch="index" id="bm_id3154589">
  <bookmark_value>MID function</bookmark_value>
</bookmark>

<bookmark branch="hid/SC_HID_FUNC_TEIL" id="bm_id3155392" localize="false"/>

<h2 id="hd_id3154589">MID</h2>
<paragraph id="par_id3154938" role="paragraph"><ahelp hid="HID_FUNC_TEIL">Returns a text string of a text. The parameters specify the starting position and the number of characters.</ahelp></paragraph>

<embed href="text/scalc/01/common_func.xhp#sectionsyntax"/>
<paragraph id="par_id3150526" role="code">MID("Text"; Start; Number)</paragraph>
<paragraph id="par_id3148820" role="paragraph"> <emph>Text</emph> is the text containing the characters to extract.</paragraph>
<paragraph id="par_id3150774" role="paragraph"> <emph>Start</emph> is the position of the first character in the text to extract.</paragraph>
<paragraph id="par_id3153063" role="paragraph"> <emph>Number</emph> specifies the number of characters in the part of the text.</paragraph>

<embed href="text/scalc/01/common_func.xhp#sectionexample"/>
<paragraph id="par_id3158407" role="paragraph"> <item type="input">=MID("office";2;2)</item> returns ff.</paragraph>
</section>

<section id="midb">
<bookmark branch="index" id="bm_id2954589">
  <bookmark_value>MIDB function</bookmark_value>
</bookmark>

<bookmark branch="hid/SC_HID_FUNC_MIDB" id="bm_id2955392" localize="false"/>

<h2 id="hd_id2954589"><variable id="midbvar"><link href="text/scalc/01/04060110.xhp#midb">MIDB</link></variable></h2>
<paragraph id="par_id2954938" role="paragraph"><ahelp hid="HID_FUNC_MIDB">Returns a text string of a DBCS text. The parameters specify the starting position and the number of characters.</ahelp></paragraph>
<embed href="text/scalc/00/avail_release.xhp#4.2"/>
<embed href="text/scalc/01/common_func.xhp#sectionsyntax"/>
<paragraph id="par_id2950526" role="code">MIDB("Text"; Start; Number_bytes)</paragraph>
<paragraph id="par_id2948820" role="paragraph"><emph>Text</emph> is the text containing the characters to extract.</paragraph>
<paragraph id="par_id2950774" role="paragraph"><emph>Start</emph> is the position of the first character in the text to extract.</paragraph>
<paragraph id="par_id2953063" role="paragraph"><emph>Number_bytes</emph> specifies the number of characters MIDB will return from text, in bytes.</paragraph>

<embed href="text/scalc/01/common_func.xhp#sectionexample"/>
<paragraph id="par_id2958417" role="paragraph"><item type="input">=MIDB("中国";1;0)</item> returns "" (0 bytes is always an empty string).</paragraph>
<paragraph id="par_id2958427" role="paragraph"><item type="input">=MIDB("中国";1;1)</item> returns " " (1 byte is only half a DBCS character and therefore the result is a space character).</paragraph>
<paragraph id="par_id2958437" role="paragraph"><item type="input">=MIDB("中国";1;2)</item> returns "中" (2 bytes constitute one complete DBCS character).</paragraph>
<paragraph id="par_id2958447" role="paragraph"><item type="input">=MIDB("中国";1;3)</item> returns "中 " (3 bytes constitute one and a half DBCS character; the last byte results in a space character).</paragraph>
<paragraph id="par_id2958457" role="paragraph"><item type="input">=MIDB("中国";1;4)</item> returns "中国" (4 bytes constitute two complete DBCS characters).</paragraph>
<paragraph id="par_id2958467" role="paragraph"><item type="input">=MIDB("中国";2;1)</item> returns " " (byte position 2 is not at the beginning of a character in a DBCS string; 1 space character is returned).</paragraph>
<paragraph id="par_id2958477" role="paragraph"><item type="input">=MIDB("中国";2;2)</item> returns " " (byte position 2 points to the last half of the first character in the DBCS string; the 2 bytes asked for therefore constitutes the last half of the first character and the first half of the second character in the string; 2 space characters are therefore returned).</paragraph>
<paragraph id="par_id2958487" role="paragraph"><item type="input">=MIDB("中国";2;3)</item> returns " 国" (byte position 2 is not at the beginning of a character in a DBCS string; a space character is returned for byte position 2).</paragraph>
<paragraph id="par_id2958497" role="paragraph"><item type="input">=MIDB("中国";3;1)</item> returns " " (byte position 3 is at the beginning of a character in a DBCS string, but 1 byte is only half a DBCS character and a space character is therefore returned instead).</paragraph>
<paragraph id="par_id2958507" role="paragraph"><item type="input">=MIDB("中国";3;2)</item> returns "国" (byte position 3 is at the beginning of a character in a DBCS string, and 2 bytes constitute one DBCS character).</paragraph>
<paragraph id="par_id2958517" role="paragraph"><item type="input">=MIDB("office";2;3)</item> returns "ffi" (byte position 2 is at the beginning of a character in a non-DBCS string, and 3 bytes of a non-DBCS string constitute 3 characters).</paragraph>
</section>

<section id="proper"><embed href="text/scalc/01/func_proper.xhp#func_proper"/></section>

<section id="regex">
<embed href="text/scalc/01/func_regex.xhp#func_regex"/>
</section>

<section id="replace"><embed href="text/scalc/01/func_replace.xhp#func_replace"/></section>

<section id="rept"><embed href="text/scalc/01/func_rept.xhp#func_rept"/></section>

<section id="right"><embed href="text/scalc/01/func_right.xhp#func_right"/></section>

<section id="rightb">
<bookmark branch="index" id="bm_id2949805">
  <bookmark_value>RIGHTB function</bookmark_value>
</bookmark>

<bookmark branch="hid/SC_HID_FUNC_RIGHTB" id="bm_id2954602" localize="false"/>

<h2 id="hd_id2949805"><variable id="rightbvar"><link href="text/scalc/01/04060110.xhp#rightb">RIGHTB</link></variable></h2>
<paragraph id="par_id2945375" role="paragraph"><ahelp hid="HID_FUNC_RIGHTB">Returns the last character or characters of a text with double bytes characters sets (DBCS).</ahelp></paragraph>
<embed href="text/scalc/00/avail_release.xhp#4.2"/>
<embed href="text/scalc/01/common_func.xhp#sectionsyntax"/>
<paragraph id="par_id2954344" role="code">RIGHTB("Text" [; Number_bytes])</paragraph>
<paragraph id="par_id2949426" role="paragraph"><emph>Text</emph> is the text of which the right part is to be determined.</paragraph>
<paragraph id="par_id2953350" role="paragraph"><emph>Number_bytes</emph> (optional) specifies the number of characters you want RIGHTB to extract, based on bytes. If this parameter is not defined, one byte is returned.</paragraph>

<embed href="text/scalc/01/common_func.xhp#sectionexample"/>
<paragraph id="par_id2951132" role="paragraph"><item type="input">RIGHTB("中国";1)</item> returns " " (1 byte is only half a DBCS character and a space character is returned instead).</paragraph>
<paragraph id="par_id2951142" role="paragraph"><item type="input">RIGHTB("中国";2)</item> returns "国" (2 bytes constitute one complete DBCS character).</paragraph>
<paragraph id="par_id2951152" role="paragraph"><item type="input">RIGHTB("中国";3)</item> returns " 国" (3 bytes constitute one half DBCS character and one whole DBCS character; a space is returned for the first half).</paragraph>
<paragraph id="par_id2951162" role="paragraph"><item type="input">RIGHTB("中国";4)</item> returns "中国" (4 bytes constitute two complete DBCS characters).</paragraph>
<paragraph id="par_id2951172" role="paragraph"><item type="input">RIGHTB("office";3)</item> returns "ice" (3 non-DBCS characters each consisting of 1 byte).</paragraph>
</section>

<section id="roman">
  <embed href="text/scalc/01/func_roman.xhp#func_roman"/>
</section>

<section id="search"><embed href="text/scalc/01/func_search.xhp#func_search"/></section>

<section id="substitute"><embed href="text/scalc/01/func_substitute.xhp#func_substitute"/></section>

<section id="t"><embed href="text/scalc/01/func_t.xhp#func_t"/></section>

<section id="text"><embed href="text/scalc/01/func_text.xhp#func_text"/></section>

<section id="trim"><embed href="text/scalc/01/func_trim.xhp#func_trim"/></section>

<section id="unichar"><embed href="text/scalc/01/func_unichar.xhp#func_unichar"/></section>

<section id="unicode"><embed href="text/scalc/01/func_unicode.xhp#func_unicode"/></section>

<section id="upper"><embed href="text/scalc/01/func_upper.xhp#func_upper"/></section>

<section id="value">
<embed href="text/scalc/01/func_value.xhp#func_value"/>
</section>

<section id="webservice">
    <embed href="text/scalc/01/func_webservice.xhp#webservicefuncheader"/>
</section>
<section id="filterxml">
    <embed href="text/scalc/01/func_webservice.xhp#filterxmlfuncheader"/>
</section>
<section id="encodeurl">
    <embed href="text/scalc/01/func_webservice.xhp#encodeurlfuncheader"/>
</section>
</sort>

<section id="relatedtopics">
<embed href="text/scalc/01/04060100.xhp#drking"/>
</section>
</body>

</helpdocument>