Skip to content

Extract utf-8 characters #1682

Closed
Closed

Description

@kostya

Library provide validation function: https://github.com/simdjson/simdjson/blob/master/doc/basics.md#utf-8-validation-alone. But is it possible to get all utf-8 characters from string? If it possible would be nice to have that feature.

Activity

  1. lemire commented on Aug 2, 2021

    @lemire
    Member

    Can you sketch the API you have in mind?

  2. kostya commented on Aug 2, 2021

    @kostya
    Author

    may be like this

        char * some_string = "[ 1, 2, 3, 4] ";
        size_t length = std::strlen(some_string);
    
        uint32_t buffer[10];
        int buffer_extracted_count;
        while(simdjson::utf8_extract_chars(&some_string, &length, buffer, 10, &buffer_extracted_count)) {
           // do something with buffer
        }

    some_string and length updated after each batch.

  3. lemire commented on Aug 2, 2021

    @lemire
    Member

    So you want UTF-8 to UTF-32 transcoding?

  4. kostya commented on Aug 2, 2021

    @kostya
    Author

    yes, looks like that, close it here, as you open it in simdutf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions