字符串处理库 utf8rewind

码农软件 · 软件分类 · 常用工具包 · 2019-08-16 13:42:25

软件介绍

utf8rewind 是跨平台的开源 C 库,扩展默认的字符串处理函数,支持 UTF-8 编码文本。

示例:

 #include "utf8rewind.h"

    int main(int argc, char** argv)
    {
        const char* input = "Hello World!";

        static const size_t output_size = 256;
        char output[output_size];
        wchar_t output_wide[output_size];
        const char* input_seek;
        size_t converted_size;
        int32_t errors;

        memset(output, 0, output_size * sizeof(char));
        memset(output_wide, 0, output_size * sizeof(wchar_t));

        /*            Convert input to uppercase:            "Hello World!" -> "HELLO WORLD!"        */

        converted_size = utf8toupper(
            input, strlen(input),
            output, output_size - 1,
            &errors);
        if (converted_size == 0 ||
            errors != UTF8_ERR_NONE)
        {
            return -1;
        }

        /*            Convert UTF-8 input to wide (UTF-16 or UTF-32) encoded text:            "HELLO WORLD!" -> L"HELLO WORLD!"        */

        converted_size = utf8towide(
            output, strlen(output),
            output_wide, (output_size - 1) * sizeof(wchar_t),
            &errors);
        if (converted_size == 0 ||
            errors != UTF8_ERR_NONE)
        {
            return -1;
        }

        /*            Seek in input:            Hello World!" -> "World!"        */

        input_seek = utf8seek(input, input, 6, SEEK_SET);

        return 0;
    }


本文地址:https://www.codercto.com/soft/d/12491.html

The Lean Startup

The Lean Startup

Eric Ries / Crown Business / 2011-9-13 / USD 26.00

更多中文介绍:http://huing.com Most startups fail. But many of those failures are preventable. The Lean Startup is a new approach being adopted across the globe, chan ging the way companies are built and ......一起来看看 《The Lean Startup》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

在线进制转换器
在线进制转换器

各进制数互转换器

随机密码生成器
随机密码生成器

多种字符组合密码