aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2013-08-08 10:16:58 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2013-08-08 10:16:58 +0200
commit99a1216c2aa4e42419c87df1683170c2c38e8753 (patch)
treef992eb2828363547d388258516086c6c39ac8230
parent9453816627ad81813580fdf43be0eafed7622c14 (diff)
downloadUstring-99a1216c2aa4e42419c87df1683170c2c38e8753.zip
Ustring-99a1216c2aa4e42419c87df1683170c2c38e8753.tar.gz
Ustring-99a1216c2aa4e42419c87df1683170c2c38e8753.tar.bz2
Add the transcode() static method.
-rw-r--r--String.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/String.php b/String.php
index 468b979..9121594 100644
--- a/String.php
+++ b/String.php
@@ -761,6 +761,20 @@ class String implements \ArrayAccess, \Countable, \IteratorAggregate {
}
/**
+ * Transcode.
+ *
+ * @access public
+ * @param string $string String.
+ * @param string $from Original encoding.
+ * @param string $to Final encoding.
+ * @return string
+ */
+ public static function transcode ( $string, $from, $to = 'UTF-8' ) {
+
+ return iconv($from, $to, $string);
+ }
+
+ /**
* Check if a string is encoded in UTF-8.
*
* @access public