You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/05-data-types/03-string/article.md
+16-14Lines changed: 16 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -659,21 +659,23 @@ In reality, this is not always the case. The reason being that the symbol `Ṩ`
659
659
660
660
If you want to learn more about normalization rules and variants -- they are described in the appendix of the Unicode standard: [Unicode Normalization Forms](http://www.unicode.org/reports/tr15/), but for most practical purposes the information from this section is enough.
661
661
662
-
## Summary
662
+
## Ringkasan
663
663
664
-
- There are 3 types of quotes. Backticks allow a string to span multiple lines and embed expressions `${…}`.
665
-
- Strings in JavaScript are encoded using UTF-16.
666
-
- We can use special characters like `\n` and insert letters by their unicode using `\u...`.
667
-
- To get a character, use: `[]`.
668
-
- To get a substring, use: `slice` or `substring`.
669
-
- To lowercase/uppercase a string, use: `toLowerCase/toUpperCase`.
670
-
- To look for a substring, use: `indexOf`, or `includes/startsWith/endsWith` for simple checks.
671
-
- To compare strings according to the language, use: `localeCompare`, otherwise they are compared by character codes.
664
+
- Terdapat 3 jenis tanda petik. Backtick memperbolehkan sebuah string untuk memiliki banyak baris dan menyipkan ekspresi `${…}`.
665
+
- String di Javascript menggunakan encoding UTF-16.
666
+
- Kita dapat menggunakan karakter seperti `\n` dan memasukkan karakter berdasarkan unicode menggunakan `\u...`.
667
+
- Untuk mengakses sebuah karakter, gunakan: `[]`.
668
+
- Untuk mengambil sebuah substring, gunakan: `slice` atau `substring`.
669
+
- Untuk mengubah case dari sebuah string, gunakan: `toLowerCase/toUpperCase`.
670
+
- Untuk mencari lokasi dari sebuah substring, gunakan: `indexOf`, atau `includes/startsWith/endsWith` untuk pengecekan apakah ada atau tidak.
671
+
- Untuk membandingkan string berdasarkan bahasa, gunakan `localeCompare`, jika tidak mereka akan dibandingkan berdasarkan kode karakter.
672
672
673
-
There are several other helpful methods in strings:
673
+
Ada beberapa method string lain yang berguna:
674
674
675
-
- `str.trim()` -- removes ("trims") spaces from the beginning and end of the string.
676
-
- `str.repeat(n)` -- repeats the string `n` times.
677
-
- ...and more to be found in the [manual](mdn:js/String).
678
675
679
-
Strings also have methods for doing search/replace with regular expressions. But that's big topic, so it's explained in a separate tutorial section <info:regular-expressions>.
676
+
- `str.trim()` -- menghilangkan ("memotong") spasi dari awal dan akhir dari sebuah string.
677
+
- `str.repeat(n)` -- mengulang string sebanyak `n` kali.
678
+
...dan masih banyak lagi yang dapat ditemukan di dalam [manual](mdn:js/String).
679
+
- ...dan masih banyak lagi yang dapat ditemukan di dalam [manual](mdn:js/String).
680
+
681
+
String juga memiliki method-method untuk mencari/mengganti dengan ekspresi reguler (regular expression). Tetapi itu adalah topik yang luas, jadi topik ini dibahas di bagiannya sendiri <info:regular-expressions>.
0 commit comments