<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          utf8rewind字符串處理庫(kù)

          聯(lián)合創(chuàng)作 · 2023-09-28 13:45

          utf8rewind 是跨平臺(tái)的開(kāi)源 C 庫(kù),擴(kuò)展默認(rèn)的字符串處理函數(shù),支持 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;
              }


          瀏覽 28
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  热亚洲热中文热日韩 | 九九久久网 | 国产av一区二区三本 | 俺也去俺来也www色官网 | 久久婷婷国产 |