Text Functions

This section contains descriptions of the Text functions.

Untuk mengakses fungsi ini...

Sisip - Fungsi - Kategori Teks


REGEX

Matches and extracts or optionally replaces text using regular expressions.

WEBSERVICE

Get some web content from a URI.

FILTERXML

Apply a XPath expression to a XML document.

ENCODEURL

Returns a URL-encoded string.

ARABIC

Calculates the value of a Roman number. The value range must be between 0 and 3999.

Syntax

ARABIC("Text")

Nilai adalah nilai yang akan diperiksa.

Example

=ARABIC("MXIV") returns 1014

=ARABIC("MMII") returns 2002

ASC

The ASC function converts full-width to half-width ASCII and katakana characters. Returns a text string.

See https://wiki.documentfoundation.org/Calc/Features/JIS_and_ASC_functions for a conversion table.

Syntax

ASC("Teks")

Nilai adalah nilai yang akan diperiksa.

Lihat juga fungsi JIS.

BAHTTEXT

Converts a number to Thai text, including the Thai currency names.

Syntax

BAHTTEXT(Angka)

Number is any number. "Baht" is appended to the integral part of the number, and "Satang" is appended to the decimal part of the number.

Example

=BAHTTEXT(12.65) returns a string in Thai characters with the meaning of "Twelve Baht and sixty five Satang".

BASE

Converts a positive integer to a specified base into a text from the numbering system. The digits 0-9 and the letters A-Z are used.

Syntax

BASE(Number; Radix; [MinimumLength])

Nilai adalah nilai yang akan diperiksa.

Radix indicates the base of the number system. It may be any positive integer between 2 and 36.

MinimumLength (optional) determines the minimum length of the character sequence that has been created. If the text is shorter than the indicated minimum length, zeros are added to the left of the string.

Example

=BASE(17;10;4) returns 0017 in the decimal system.

=BASE(17;2) returns 10001 in the binary system.

=BASE(255;16;4) returns 00FF in the hexadecimal system.

CHAR

Converts a number into a character according to the current code table. The number can be a two-digit or three-digit integer number.

Kode lebih dari 127 mungkin bergantung kepada pemetaan karakter sistem Anda (sebagai contoh iso-8859-1, iso-8859-2, Windows-1252, Windows-1250), dan mungkin tak akan portabel.

Syntax

CHAR(angka)

Number is a number between 1 and 255 representing the code value for the character.

Example

=CHAR(100) returns the character d.

="abc" & CHAR(10) & "def" inserts a newline character into the string.

CLEAN

All non-printing characters are removed from the string.

Syntax

CLEAN("Text")

Text refers to the text from which to remove all non-printable characters.

CODE

Returns a numeric code for the first character in a text string.

Syntax

CODE("Text")

Text is the text for which the code of the first character is to be found.

Kode lebih dari 127 mungkin bergantung kepada pemetaan karakter sistem Anda (sebagai contoh iso-8859-1, iso-8859-2, Windows-1252, Windows-1250), dan mungkin tak akan portabel.

Example

=CODE("Hieronymus") returns 72, =CODE("hieroglyphic") returns 104.

Ikon Catatan

The code used here does not refer to ASCII, but to the code table currently loaded.


CONCATENATE

Combines several text strings into one string.

Syntax

CONCATENATE("Text1"; ...; "Text30")

Text 1; Text 2; ... represent up to 30 text passages which are to be combined into one string.

Example

=CONCATENATE("Good ";"Morning ";"Mrs. ";"Doe") returns: Good Morning Mrs. Doe.

DECIMAL

Converts text with characters from a number system to a positive integer in the base radix given. The radix must be in the range 2 to 36. Spaces and tabs are ignored. The Text field is not case-sensitive.

If the radix is 16, a leading x or X or 0x or 0X, and an appended h or H, is disregarded. If the radix is 2, an appended b or B is disregarded. Other characters that do not belong to the number system generate an error.

Syntax

DECIMAL("Text"; Radix)

Text is the text to be converted. To differentiate between a hexadecimal number, such as A1 and the reference to cell A1, you must place the number in quotation marks, for example, "A1" or "FACE".

Radix indicates the base of the number system. It may be any positive integer between 2 and 36.

Example

=DECIMAL("17";10) returns 17.

=DECIMAL("FACE";16) returns 64206.

=DECIMAL("0101";2) returns 5.

DOLLAR

Converts a number to an amount in the currency format, rounded to a specified decimal place. In the Value field enter the number to be converted to currency. Optionally, you may enter the number of decimal places in the Decimals field. If no value is specified, all numbers in currency format will be displayed with two decimal places.

You set the currency format in your system settings.

Syntax

DOLLAR(Value; Decimals)

Value is a number, a reference to a cell containing a number, or a formula which returns a number.

Decimals is the optional number of decimal places.

Example

=DOLLAR(255) returns $255.00.

=DOLLAR(367.456;2) returns $367.46. Use the decimal separator that corresponds to the current locale setting.

EXACT

Compares two text strings and returns TRUE if they are identical. This function is case-sensitive.

Syntax

EXACT("Text1"; "Text2")

Nilai adalah nilai yang akan diperiksa.

Nilai adalah nilai yang akan diperiksa.

Example

=EXACT("microsystems";"Microsystems") returns FALSE.

FIND

Returns the position of a string of text within another string.You can also define where to begin the search. The search term can be a number or any string of characters. The search is case-sensitive.

Syntax

FIND("TeksYgDicari"; "Teks"; Posisi)

Nilai adalah nilai yang akan diperiksa.

Text is the text where the search takes place.

Position (optional) is the position in the text from which the search starts.

Example

=FIND(76;998877665544) returns 6.

FIXED

Returns a number as text with a specified number of decimal places and optional thousands separators.

Syntax

FIXED(Number; Decimals; NoThousandsSeparators)

Nilai adalah nilai yang akan diperiksa.

Decimals refers to the number of decimal places to be displayed.

NoThousandsSeparators (optional) determines whether the thousands separator is used. If the parameter is a number not equal to 0, the thousands separator is suppressed. If the parameter is equal to 0 or if it is missing altogether, the thousands separators of your current locale setting are displayed.

Example

=FIXED(1234567.89;3) returns 1,234,567.890 as a text string.

=FIXED(1234567.89;3;1) returns 1234567.890 as a text string.

JIS

The JIS function converts half-width to full-width ASCII and katakana characters. Returns a text string.

See https://wiki.documentfoundation.org/Calc/Features/JIS_and_ASC_functions for a conversion table.

Syntax

JIS("Teks")

Nilai adalah nilai yang akan diperiksa.

Lihat juga fungsi ASC.

LEFT

Returns the first character or characters of a text.

Syntax

LEFT("Text"; Number)

Text is the text where the initial partial words are to be determined.

Number (optional) specifies the number of characters for the start text. If this parameter is not defined, one character is returned.

Example

=LEFT("output";3) returns “out”.

LEFTB

Returns the first characters of a DBCS text.

Syntax

LEFTB("Text"; Number_bytes)

Text is the text where the initial partial words are to be determined.

Number_bytes (optional) specifies the number of characters you want LEFTB to extract, based on bytes. If this parameter is not defined, one character is returned.

Example

LEFTB("中国";1) returns " " (1 byte is only half a DBCS character and a space character is returned instead).

LEFTB("中国";2) returns "中" (2 bytes constitute one complete DBCS character).

LEFTB("中国";3) returns "中 " (3 bytes constitute one DBCS character and a half; the last character returned is therefore a space character).

LEFTB("中国";4) returns "中国" (4 bytes constitute two complete DBCS characters).

LEFTB("office";3) returns "off" (3 non-DBCS characters each consisting of 1 byte).

LEN

Returns the length of a string including spaces.

Syntax

LEN("Text")

Text is the text whose length is to be determined.

Example

=LEN("Good Afternoon") returns 14.

=LEN(12345.67) returns 8.

LENB

For double-byte character set (DBCS) languages, returns the number of bytes used to represent the characters in a text string.

Syntax

LENB("Text")

Text is the text whose length is to be determined.

Example

LENB("中") returns 2 (1 DBCS character consisting of 2 bytes).

LENB("中国") returns 4 (2 DBCS characters each consisting of 2 bytes).

LENB("office") returns 6 (6 non-DBCS characters each consisting of 1 byte).

=LENB("Good Afternoon") returns 14.

=LENB(12345.67) returns 8.

LOWER

Converts all uppercase letters in a text string to lowercase.

Syntax

LOWER("Teks")

Nilai adalah nilai yang akan diperiksa.

Example

=LOWER("Sun") mengembalikan sun.

MID

Menghasilkan teks string dari teks. Parameter menentukan posisi awal dan nomor karakter.

Syntax

MID("Teks"; Mulai; Nomor)

Teks adalah teks yang berisi karakter yang diekstrak.

Mulai adalah posisi pertama karakter dalam teks yang diekstrak.

Nomor menentukan nomor karakter pada bagian teks.

Example

=MID("office";2;2) mengembalikan ff.

MIDB

Mengembalikan untai teks dari teks DBCS. Parameter menentukan posisi awal dan nomor karakter.

Syntax

MIDB("Teks"; Mulai; Nomor_bita)

Teks adalah teks yang berisi karakter yang diekstrak.

Mulai adalah posisi pertama karakter dalam teks yang diekstrak.

Nomor_bita menentukan jumlah karakter yang akan dikembalikan dari teks, dalam bita.

Example

MIDB("中国";1;0) mengembalikan "" (0 bita selalu berupa untai kosong).

MIDB("中国";1;1) mengembalikan " " (1 bita hanya separuh karakter DBCS dan karenanya hasilnya adalah karakter spasi).

MIDB("中国";1;2) mengembalikan "中" (2 bita merupakan satu karakter DBCSlengkap).

MIDB("中国";1;3) mengembalikan "中 " (3 merupakan satu setengah karakter DBCS; bita terakhir menghasilkan karakter spasi).

MIDB("中国";1;4) mengembalikan "中国" (4 bita merupakan dua karakter DBCS lengkap).

MIDB("中国";2;1) mengembalikan " " (posisi bita 2 bukan merupakan permulaan karakter DBCS dalam untaian; karakter 1 dikembalikan).

MIDB("中国";2;2) mengembalikan " " (posisi bita 2 menunjuk ke bagian terakhir dari karakter pertama dalam untaian DBCS; oleh karena itu 2 bita yang diminta merupakan bagian terakhir dari karakter pertama dan bagian pertama dari karakter kedua dalam untaian; karena itu 2 karakter spasi dikembalikan).

MIDB("中国";2;3) mengembalikan " 国" (posisi bita 2 tidak berada di permulaan karakter dalam untaian DBCS; sebuah karakter spasi dikembalikan untuk bita posisi 2).

MIDB("中国";3;1) mengembalikan " " (posisi bita 3 pada permulaan karakter dalam untaian DBCS, tetapi 1 bita hanya setengah karakter DBCS dan oleh karena itu karakter spasi dikembalikan).

MIDB("中国";3;2) mengembalikan "国" (posisi bita 3 di awal karakter dalam untai DBCS, dan 2 bita merupakan satu karakter DBCS).

MIDB("office";2;3) mengembalikan "ffi" (posisi bita 2 di awal karakter dalam untai non-DBCS, dan 3 bita dari untai non-DBCS membentuk 3 karakter).

PROPER

Mengapitalisasi huruf pertama dalam semua kata dari untai teks.

Syntax

PROPER("Teks")

Nilai adalah nilai yang akan diperiksa.

Example

=PROPER("open office") mengembalikan Open Office.

REPLACE

mengganti bagian dari untuk teks dengan untai teks yang berbeda. Fungsi ini dapat digunakan untuk mengganti karakter dan angka (yang secara otomatis dikonversi menjadi teks). Hasil dari fungsi tersebut selalu ditampilkan sebagai teks. Jika Anda berniat melakukan penghitungan lebih lanjut dengan angka yang telah diganti oleh teks, Anda harus mengonversinya kembali ke angka menggunakan fungsi VALUE.

Setiap teks berisi angka harus ditutup dengan tanda petik jika Anda tidak ingin angka tersebut dianggap sebagai nomor dan secara otomatis dikonversi ke teks.

Syntax

REPLACE("Teks"; Posisi; Panjang; "TeksBaru")

Teks mengacu pada bagian teks yang akan diganti.

Posisi mengacu pada posisi di dalam teks di mana penggantian akan dimulai.

Panjang adalah nomor karakter dalam Teks yang akan diganti.

TeksBaru mengacu pada teks yang menggantikan Teks.

Example

=REPLACE("1234567";1;1;"444") mengembalikan "444234567". Satu karakter pada posisi 1 diganti sepenuhnya dengan TeksBaru.

REPT

Mengulang karakter untai dengan jumlah salinan yang diberikan.

Syntax

REPT("Teks"; Nomor)

Nilai adalah nilai yang akan diperiksa.

Nilai adalah nilai yang akan diperiksa.

Hasilnya dapat maksimal 255 karakter.

Example

=REPT("Selamat pagi";2) mengembalikan Selamat pagiSelamat pagi.

RIGHT

Returns the last character or characters of a text.

Syntax

RIGHT("Text"; Number)

Text is the text of which the right part is to be determined.

Number (optional) is the number of characters from the right part of the text.

Example

=RIGHT("Sun";2) returns un.

RIGHTB

Returns the last character or characters of a text with double bytes characters sets (DBCS).

Syntax

RIGHTB("Text"; Number_bytes)

Text is the text of which the right part is to be determined.

Number_bytes (optional) specifies the number of characters you want RIGHTB to extract, based on bytes.

Example

RIGHTB("中国";1) returns " " (1 byte is only half a DBCS character and a space character is returned instead).

RIGHTB("中国";2) returns "国" (2 bytes constitute one complete DBCS character).

RIGHTB("中国";3) returns " 国" (3 bytes constitute one half DBCS character and one whole DBCS character; a space is returned for the first half).

RIGHTB("中国";4) returns "中国" (4 bytes constitute two complete DBCS characters).

RIGHTB("office";3) returns "ice" (3 non-DBCS characters each consisting of 1 byte).

ROMAN

Converts a number into a Roman numeral. The value range must be between 0 and 3999, the modes can be integers from 0 to 4.

Syntax

ROMAN(Number; Mode)

Number is the number that is to be converted into a Roman numeral.

Mode (optional) indicates the degree of simplification. The higher the value, the greater is the simplification of the Roman number.

Example

=ROMAN(999) returns CMXCIX

=ROMAN(999;0) returns CMXCIX

=ROMAN (999;1) returns LMVLIV

=ROMAN(999;2) returns XMIX

=ROMAN(999;3) returns VMIV

=ROMAN(999;4) returns IM

SEARCH

Returns the position of a text segment within a character string. You can set the start of the search as an option. The search text can be a number or any sequence of characters. The search is not case-sensitive. If the text is not found, returns error 519 (#VALUE).

Bantuan pencarian ekspresi regular. Anda dapat memasukan "all.*", sebagai contoh untuk mencari lokasi pertama dari "all" diikuti dengan karakter apapun. Jika Anda menginginkan pencarian untuk teks yang juga ekspresi regular, Anda harus mendahului setiap karakter dengan sebuah karakter "\". Anda dapat mengganti dengan evaluasi otomatis dari ekspresi regular menyala dan mati di - LibreOffice Calc - Kalkulasi.

Syntax

SEARCH("TeksYgDicari"; "Teks"; Posisi)

Nilai adalah nilai yang akan diperiksa.

Text is the text where the search will take place.

Position (optional) is the position in the text where the search is to start.

Example

=SEARCH(54;998877665544) returns 10.

SUBSTITUTE

Substitutes new text for old text in a string.

Syntax

SUBSTITUTE("Text"; "SearchText"; "NewText"; Occurrence)

Text is the text in which text segments are to be exchanged.

SearchText is the text segment that is to be replaced (a number of times).

NewText is the text that is to replace the text segment.

Occurrence (optional) indicates which occurrence of the search text is to be replaced. If this parameter is missing the search text is replaced throughout.

Example

=SUBSTITUTE("123123123";"3";"abc") returns 12abc12abc12abc.

=SUBSTITUTE("123123123";"3";"abc";2) returns 12312abc123.

T

This function returns the target text, or a blank text string if the target is not text.

Syntax

T(nilai)

If Value is a text string or refers to a text string, T returns that text string; otherwise it returns a blank text string.

Example

=T(12345) returns an empty string.

=T("12345") returns the string 12345.

TEXT

Converts a number into text according to a given format.

Syntax

TEXT(Number; Format)

Nilai adalah nilai yang akan diperiksa.

Format is the text which defines the format. Use decimal and thousands separators according to the language set in the cell format.

Example

=TEXT(12.34567;"###.##") returns the text 12.35

=TEXT(12.34567;"000.00") returns the text 012.35

Ikon Tip

See also Number format codes: custom format codes defined by the user.


TRIM

Removes spaces from a string, leaving only a single space character between words.

Syntax

TRIM("Text")

Text refers to text in which spaces are to be removed.

Example

=TRIM(" hello world ") returns hello world without leading and trailing spaces and with single space between words.

UNICHAR

Converts a code number into a Unicode character or letter.

Syntax

UNICHAR(number)

Example

=UNICHAR(169) returns the Copyright character ©.

Ikon Tip

See also the UNICODE() function.


UNICODE

Returns the numeric code for the first Unicode character in a text string.

Syntax

UNICODE("Text")

Example

=UNICODE("©") returns the Unicode number 169 for the Copyright character.

Ikon Tip

See also the UNICHAR() function.


UPPER

Converts the string specified in the text field to uppercase.

Syntax

UPPER("Text")

Text refers to the lower case letters you want to convert to upper case.

Example

=UPPER("Good Morning") returns GOOD MORNING.

VALUE

Mengonversi teks menjadi angka.

Syntax

DATEVALUE("Teks")

Nilai adalah nilai yang akan diperiksa.

Example

=VALUE("4321") returns 4321.