• Qt


    (一)编码转换

    QString:
    ---------------------------------------------------------------------------------

    普通成员函数:

    QByteArray toAscii () const
    QByteArray toLatin1 () const
    QByteArray toLocal8Bit () const
    QByteArray toUtf8 () const
    const ushort * utf16 () const
    const QChar * unicode () const
    QVector<uint> toUcs4 () const
    std::string toStdString () const
    std::wstring toStdWString () const
    int toWCharArray ( wchar_t * array ) const

    静态成员函数:

    QString fromAscii ( const char * str, int size = -1 )
    QString fromLatin1 ( const char * str, int size = -1 )
    QString fromLocal8Bit ( const char * str, int size = -1 )
    QString fromUtf8 ( const char * str, int size = -1 )
    QString fromUtf16 ( const ushort * unicode, int size = -1 )
    QString fromRawData ( const QChar * unicode, int size )
    QString fromUcs4 ( const uint * unicode, int size = -1 )
    QString fromStdString ( const std::string & str )
    QString fromStdWString ( const std::wstring & str )
    QString fromWCharArray ( const wchar_t * string, int size = -1 )

    QByteArray:
    ---------------------------------------------------------------------------------

    普通成员函数:

    const char * constData () const
    char * data ()
    const char * data () const
    QByteArray toBase64 () const
    QByteArray toHex () const
    QByteArray toPercentEncoding ( const QByteArray & exclude = QByteArray(), const QByteArray & include = QByteArray(), char percent = '%' ) const
    QByteArray & setRawData ( const char * data, uint size )

    静态成员函数:

    QByteArray fromBase64 ( const QByteArray & base64 )
    QByteArray fromHex ( const QByteArray & hexEncoded )
    QByteArray fromPercentEncoding ( const QByteArray & input, char percent = '%' )
    QByteArray fromRawData ( const char * data, int size )

    (二)类型转换

    QString:

    ---------------------------------------------------------------------------------

    普通成员函数:

    int toInt ( bool * ok = 0, int base = 10 ) const
    uint toUInt ( bool * ok = 0, int base = 10 ) const
    short toShort ( bool * ok = 0, int base = 10 ) const
    ushort toUShort ( bool * ok = 0, int base = 10 ) const
    long toLong ( bool * ok = 0, int base = 10 ) const
    ulong toULong ( bool * ok = 0, int base = 10 ) const
    qlonglong toLongLong ( bool * ok = 0, int base = 10 ) const
    qulonglong toULongLong ( bool * ok = 0, int base = 10 ) const
    double toDouble ( bool * ok = 0 ) const
    float toFloat ( bool * ok = 0 ) const

    QString & setNum ( int n, int base = 10 )
    QString & setNum ( uint n, int base = 10 )
    QString & setNum ( short n, int base = 10 )
    QString & setNum ( ushort n, int base = 10 )
    QString & setNum ( long n, int base = 10 )
    QString & setNum ( ulong n, int base = 10 )
    QString & setNum ( qlonglong n, int base = 10 )
    QString & setNum ( qulonglong n, int base = 10 )
    QString & setNum ( double n, char format = 'g', int precision = 6 )
    QString & setNum ( float n, char format = 'g', int precision = 6 )

    静态成员函数:

    QString number ( int n, int base = 10 )
    QString number ( uint n, int base = 10 )
    QString number ( long n, int base = 10 )
    QString number ( ulong n, int base = 10 )
    QString number ( qlonglong n, int base = 10 )
    QString number ( qulonglong n, int base = 10 )
    QString number ( double n, char format = 'g', int precision = 6 )

    QByteArray:
    ---------------------------------------------------------------------------------

    普通成员函数:

    int toInt ( bool * ok = 0, int base = 10 ) const
    uint toUInt ( bool * ok = 0, int base = 10 ) const
    short toShort ( bool * ok = 0, int base = 10 ) const
    ushort toUShort ( bool * ok = 0, int base = 10 ) const
    long toLong ( bool * ok = 0, int base = 10 ) const
    ulong toULong ( bool * ok = 0, int base = 10 ) const
    qlonglong toLongLong ( bool * ok = 0, int base = 10 ) const
    qulonglong toULongLong ( bool * ok = 0, int base = 10 ) const
    double toDouble ( bool * ok = 0 ) const
    float toFloat ( bool * ok = 0 ) const

    QByteArray & setNum ( int n, int base = 10 )
    QByteArray & setNum ( uint n, int base = 10 )
    QByteArray & setNum ( short n, int base = 10 )
    QByteArray & setNum ( ushort n, int base = 10 )
    QByteArray & setNum ( qlonglong n, int base = 10 )
    QByteArray & setNum ( qulonglong n, int base = 10 )
    QByteArray & setNum ( double n, char f = 'g', int prec = 6 )
    QByteArray & setNum ( float n, char f = 'g', int prec = 6 )

    静态成员函数:

    QByteArray number ( int n, int base = 10 )
    QByteArray number ( uint n, int base = 10 )
    QByteArray number ( qlonglong n, int base = 10 )
    QByteArray number ( qulonglong n, int base = 10 )
    QByteArray number ( double n, char f = 'g', int prec = 6 )

  • 相关阅读:
    hdu5728 PowMod
    CF1156E Special Segments of Permutation
    CF1182E Product Oriented Recurrence
    CF1082E Increasing Frequency
    CF623B Array GCD
    CF1168B Good Triple
    CF1175E Minimal Segment Cover
    php 正则
    windows 下安装composer
    windows apache "The requested operation has failed" 启动失败
  • 原文地址:https://www.cnblogs.com/paullam/p/3711822.html
Copyright © 2020-2023  润新知