Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
strings.reverse
strings.reverse(STRING)
Deskripsi
Menampilkan string yang merupakan kebalikan dari string input.
Jenis data parameter
STRING
Jenis hasil yang ditampilkan
STRING
Contoh kode
Contoh 1
Contoh berikut meneruskan string pendek.
strings.reverse("str") = "rts" // The function returns 'rts'.
Contoh 2
Contoh berikut meneruskan string kosong.
strings.reverse("") = ""
Contoh 3
Contoh berikut meneruskan palindrom.
strings.reverse("tacocat") = "tacocat"
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-29 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-07-29 UTC."],[[["\u003cp\u003eThe \u003ccode\u003estrings.reverse\u003c/code\u003e function reverses the order of characters in a given string.\u003c/p\u003e\n"],["\u003cp\u003eIt accepts a single string (\u003ccode\u003eSTRING\u003c/code\u003e) as input and returns a reversed string (\u003ccode\u003eSTRING\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003ePassing an empty string to \u003ccode\u003estrings.reverse\u003c/code\u003e will return an empty string.\u003c/p\u003e\n"],["\u003cp\u003eIf a palindrome is passed to this function it will return the same string.\u003c/p\u003e\n"]]],[],null,["### strings.reverse\n\nSupported in: \n[Rules](/chronicle/docs/detection/default-rules) [Search](/chronicle/docs/investigation/udm-search) \n\n strings.reverse(STRING)\n\n#### Description\n\nReturns a string that is the reverse of the input string.\n\n#### Param data types\n\n`STRING`\n\n#### Return type\n\n`STRING`\n\n#### Code samples\n\n##### Example 1\n\nThe following example passes a short string. \n\n strings.reverse(\"str\") = \"rts\" // The function returns 'rts'.\n\n##### Example 2\n\nThe following example passes an empty string. \n\n strings.reverse(\"\") = \"\"\n\n##### Example 3\n\nThe following example passes a palindrome. \n\n strings.reverse(\"tacocat\") = \"tacocat\""]]