开发者

What are intvectors and how to read/use them?

开发者 https://www.devze.com 2023-03-22 08:28 出处:网络
How do i apply the integers/intvectors formatted in a ICU data file... For example; US{ { id{\"USD\"} from:intvector{ /** 1792-01-01*/

How do i apply the integers/intvectors formatted in a ICU data file...

For example;

    US{
        {
            id{"USD"}
            from:intvector{ /** 1792-01-01  */
                -1308,
                694083168,
            }
        }

Can i format these to a human-readable "from" date, e.g. 1792-01-01 in PHP?

Thanks

// Roland

Edit: I have the integers in PHP;

["US"] => array(3)
{
  [0] => array(2)
  {
    ["from"] => array(2)
    {
      [0] => int(-1308)
      [1] => int(694083168)
    }开发者_如何学C
    ["id"] => string(3) "USD"
  }
}


So, the intvectors are just an array of ints.

Boldface: You should not be reading the ICU data directly !!! Use APIs.

http://icu-project.org/apiref/icu4c/ucurr_8h.html is the API which works with this data.

If you really want to get at this data directly,

  • get it from CLDR: http://cldr.unicode.org/ such as the
  • Currency supplemental data http://www.unicode.org/repos/cldr/trunk/common/supplemental/supplementalData.xml and you can
  • read the charts http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/detailed_territory_currency_information.html and especially the
  • spec http://cldr.unicode.org/index/cldr-spec

But please don't read the internal ICU data directly.


You can use json-decode for this task.

0

精彩评论

暂无评论...
验证码 换一张
取 消