======================================================================
 mb Cheat Sheet                                  [ID] Bahasa Indonesia
======================================================================

[ 1. Load ]
  use mb;
  mb::set_script_encoding('utf8'); # utf8 / sjis / eucjp / big5 / gbk / uhc

[ 2. Character-oriented length / substr ]
  mb::length($str)              # number of characters (not bytes)
  mb::substr($str, $pos, $len)  # substring by character position
  mb::substr($str, $pos, $len, $replacement)

[ 3. Search ]
  mb::index($str, $sub)         # character-position index
  mb::index($str, $sub, $pos)   # search from $pos
  mb::rindex($str, $sub)        # right-side search
  mb::index_byte($str, $sub)    # byte-position index (JPerl semantics)
  mb::rindex_byte($str, $sub)

[ 4. Character conversion ]
  mb::uc($str)                  # uppercase
  mb::lc($str)                  # lowercase
  mb::ucfirst($str)             # capitalize first char
  mb::lcfirst($str)

[ 5. Character code ]
  mb::ord($str)                 # codepoint of first character
  mb::chr($n)                   # character from codepoint

[ 6. Other string operations ]
  mb::chop($str)                # remove last character
  mb::reverse(@list)            # reverse characters or list
  mb::getc(FH)                  # read one character from filehandle
  mb::tr($str, $from, $to)      # transliterate characters

[ 7. Supported encodings ]
  utf8  sjis  eucjp  big5  big5hkscs  gbk  uhc  gb18030  rfc2279  wtf8

[ 8. Example ]
  use mb;
  mb::set_script_encoding('utf8');
  my $s = "Hello World";
  printf "length=%d\n", mb::length($s);    # character count
  printf "sub=%s\n",    mb::substr($s,0,5); # "Hello"
  printf "pos=%d\n",    mb::index($s,"World"); # 6

[ 9. Regex titik kode saat runtime (mb::qr) ]
  use mb qw(*mb utf8);
  $str =~ mb::qr(qr/./)         # "." cocok dengan satu titik kode
  $str =~ m{\G$mb{qr/(.)/}gc}   # setara bentuk tie

[ 10. Validasi byte yang benar (mb::valid) ]
  mb::valid($octets)            # 1 jika benar, 0 jika tidak
                                # ketat, opsional; bergantung pada enkoding

[ 11. Pisah per codepoint (mb::split) ]
  @f = mb::split(qr/,/, $csv)   # pisah pada batas codepoint

[ 12. Tiga cara menjalankan (filter / modulino / runtime) ]
  use mb;                       # jalur 1: filter sumber (perl 5.8+)
  perl mb.pm script.pl          # jalur 2: modulino
  use mb qw(*mb utf8);          # jalur 3: antarmuka runtime
