I18N_UnicodeString
[ class tree: I18N_UnicodeString ] [ index: I18N_UnicodeString ] [ all elements ]

Source for file substringreplace_example.php

Documentation is available at substringreplace_example.php

  1. <?php
  2. header('Content-type: text/html; charset=UTF-8');
  3. require('I18N/UnicodeString.php');
  4.  
  5. $text = <<<EOT
  6. The Greek Alphabet<br />
  7. &#945; - alpha<br />
  8. &#946; - beta<br />
  9. &#947; - gamma<br />
  10. &#948; - delta<br />
  11. &#949; - epsilon<br />
  12. &#950; - zeta<br />
  13. &#951; - eta<br />
  14. &#952; - theta<br />
  15. &#953; - iota<br />
  16. &#954; - kappa<br />
  17. &#955; - lamda<br />
  18. &#956; - mu<br />
  19. &#957; - nu<br />
  20. &#958; - xi<br />
  21. &#959; - omikron<br />
  22. &#960; - pi<br />
  23. &#961; - rho<br />
  24. &#962; - sigma<br />
  25. &#964; - tau<br />
  26. &#965; - upsilon<br />
  27. &#966; - phi<br />
  28. &#967; - chi<br />
  29. &#968; - psi<br />
  30. &#969; - omega
  31. EOT;
  32.  
  33. $u = new I18N_UnicodeString($text'HTML');
  34. $u $u->stringReplace(new I18N_UnicodeString('&#954; - kappa''HTML')new I18N_UnicodeString('&#922; - uppercase kappa''HTML'))// initial replacement
  35. $u $u->subStringReplace(new I18N_UnicodeString('&#959; - omikron''HTML')new I18N_UnicodeString('&#927; - uppercase omikron''HTML')$u->indexOf(922)5)// wont work, length is to short
  36. $u $u->subStringReplace(new I18N_UnicodeString('&#962; - sigma''HTML')new I18N_UnicodeString('&#931; - uppercase sigma''HTML')$u->indexOf(922))// will work
  37. echo $u->toUtf8String();
  38. ?>

Documentation generated on Mon, 11 Mar 2019 15:47:55 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.