======================================================================
 mb Cheat Sheet                                            [UZ] O'zbek
======================================================================

[ 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. Ish vaqti kod nuqtasi regex (mb::qr) ]
  use mb qw(*mb utf8);
  $str =~ mb::qr(qr/./)         # "." bitta kod nuqtasiga mos keladi
  $str =~ m{\G$mb{qr/(.)/}gc}   # tie shakliga teng

[ 10. To'g'ri baytlarni tekshirish (mb::valid) ]
  mb::valid($octets)            # to'g'ri bo'lsa 1, aks holda 0
                                # qat'iy, ixtiyoriy; kodlashga bog'liq

[ 11. Kod nuqtasi bo'yicha bo'lish (mb::split) ]
  @f = mb::split(qr/,/, $csv)   # kod nuqtasi chegaralarida bo'ladi

[ 12. Ishga tushirishning uch usuli (filter / modulino / runtime) ]
  use mb;                       # yo'l 1: manba filtri (perl 5.8+)
  perl mb.pm script.pl          # yo'l 2: modulino
  use mb qw(*mb utf8);          # yo'l 3: ish vaqti interfeysi
