1 / 7

Basic String Operations in SET Language

Learn how to manipulate strings using SET language commands such as deleting, concatenating, copying, finding positions, checking length, and inserting substrings.

leyna
Download Presentation

Basic String Operations in SET Language

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SET and String

  2. Type Nama_set = set of tipe_dasar; Contoh Type Angka = set of 0 .. 9; Type Rupa = (merah, hijau, kuning, biru, ungu); Warna = set of Rupa; Ataubisajugalangsungsebagaiberikut : Type Warna = set of (merah, hijau, kuning, biru, ungu);

  3. Type Mobil = (accord, baleno, charade, civic, corolla, kijang, kuda, panther, vitara, zebra); HimpMobil = set of Mobil; Var Bela, Disa, Kira, Maya, Orak : HimpMobil; Begin Bela := [baleno, civic, vitara]; Disa := [accord .. corolla, vitara]; Kira := [kijang .. zebra]; Maya := [kijang, kuda, panther]; Orak := [];

  4. OperasiHimpunan

  5. Prosedure • Delete(nama_string, indeks, jumlah); Kata := ‘SelamatBelajar’ Delete(Kata, 5,3) hasilnyaadalah ‘SelaBelajar’. • Concat(s1, s2 {,s3,…, sn}); • Copy(nama_string, indeks, jumlah); Kata := ‘UMS Surakarta’ Copy(Kata,5,7) hasilnyaadalah ‘Surakar’

  6. Prosedure • Pos(sub_string, nama_string); Kalimat := ’IkhlasBeramal’ Kata1 := ‘amal’ Kata2 := ‘semu’ Pos(kata1, Kalimat) hasilnyaadalah 11 Pos(kata2, Kalimat) hasilnyaadalah 0 • Length(nama_string);

  7. Prosedure Insert(string_asal,string_tujuan, indeks); Kata1 := ‘Jurusan UMS’ Kata2 := ‘Matematika ’ Insert(Kata2, Kata1, 9) hasilnya ‘JurusanMatematika UMS’

More Related