From: Alexander Turenko <alexander.turenko@tarantool.org> To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Cc: kostja@tarantool.org, tarantool-patches@freelists.org Subject: [tarantool-patches] Re: [PATCH 2/7] lua: implement string.u_count Date: Sat, 28 Apr 2018 04:10:56 +0300 [thread overview] Message-ID: <20180428011055.h55f36uitb7txrg2@tkn_work_nb> (raw) In-Reply-To: <a89c3b4d0946d32673fa3a6a4570a3002de4f81b.1524698920.git.v.shpilevoy@tarantool.org> Just one tiny comment below. WBR, Alexander Turenko. On Thu, Apr 26, 2018 at 02:29:02AM +0300, Vladislav Shpilevoy wrote: > Lua can not calculate length of a unicode string correctly. But > Tarantool has ICU on board - lets use it to calculate length. > > u_count has options, that allows to count only symbols of a > specific class, for example, only capital letters, or digits. > Options can be combined. > > Closes #3081 > --- > extra/exports | 1 + > src/CMakeLists.txt | 1 + > src/lua/string.lua | 52 ++++++++++++++++++++++++++++++++++++++++++++ > src/util.c | 48 +++++++++++++++++++++++++++++++++++++++- > test/app-tap/string.test.lua | 22 ++++++++++++++++++- > 5 files changed, 122 insertions(+), 2 deletions(-) > > <...> > diff --git a/src/util.c b/src/util.c > index 9458695b9..c117dee05 100644 > --- a/src/util.c > +++ b/src/util.c > <...> > +/** > + * Get length of a UTF8 string. > + * @param s UTF8 string. > + * @param bsize Binary size of @an s. Whether it worth to clarify that it is w/o trailing '\0'? > + * @param flags Binary OR of u_count_class flags. > + * @retval >=0 Count of symbols matched one of @a flags. > + * @retval <0 Invalid UTF8 on the position -1 * returned value. > + */ > +int > +u_count(const char *s, int bsize, uint8_t flags) > +{
next prev parent reply other threads:[~2018-04-28 1:10 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-04-25 23:29 [tarantool-patches] [PATCH 0/7] Expose ICU into Lua Vladislav Shpilevoy 2018-04-25 23:29 ` [tarantool-patches] [PATCH 1/7] lua: expose ICU upper/lower functions to Lua Vladislav Shpilevoy 2018-04-28 0:56 ` [tarantool-patches] " Alexander Turenko 2018-04-25 23:29 ` [tarantool-patches] [PATCH 2/7] lua: implement string.u_count Vladislav Shpilevoy 2018-04-26 10:36 ` [tarantool-patches] " Vladislav Shpilevoy 2018-04-26 16:07 ` Vladislav Shpilevoy 2018-04-26 23:57 ` Vladislav Shpilevoy 2018-04-28 1:10 ` Alexander Turenko [this message] 2018-04-25 23:29 ` [tarantool-patches] [PATCH 3/7] alter: fix assertion in collations alter Vladislav Shpilevoy 2018-04-25 23:29 ` [tarantool-patches] [PATCH 4/7] Move struct on_access_denied_ctx into error.h Vladislav Shpilevoy 2018-04-25 23:29 ` [tarantool-patches] [PATCH 5/7] Merge box_error, stat and collations into core library Vladislav Shpilevoy 2018-04-25 23:29 ` [tarantool-patches] [PATCH 6/7] Always store built-in collations in the cache Vladislav Shpilevoy 2018-04-25 23:29 ` [tarantool-patches] [PATCH 7/7] lua: expose u_compare/u_icompare into Lua Vladislav Shpilevoy 2018-04-28 1:55 ` [tarantool-patches] Re: [PATCH 0/7] Expose ICU " Alexander Turenko
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20180428011055.h55f36uitb7txrg2@tkn_work_nb \ --to=alexander.turenko@tarantool.org \ --cc=kostja@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=v.shpilevoy@tarantool.org \ --subject='[tarantool-patches] Re: [PATCH 2/7] lua: implement string.u_count' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox