MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / str_length

Function str_length

src/util/strutil.c:57–76  ·  view source on GitHub ↗

determine the length of the string not in terms of the number of bytes in the string but in terms of the number of Unicode characters in the string

Source from the content-addressed store, hash-verified

55// not in terms of the number of bytes in the string
56// but in terms of the number of Unicode characters in the string
57int str_length
58(
59 const char *str
60) {
61 // hold current Unicode character
62 utf8proc_int32_t c;
63
64 int len = 0;
65
66 // while we didn't get to the end of the string
67 while(str[0] != 0) {
68 // increment current position by number of bytes in Unicode character
69 str += utf8proc_iterate((const utf8proc_uint8_t *)str, -1, &c);
70 // increment length of the string in terms of Unicode characters
71 len++;
72 }
73
74 // return the length of the string in terms of Unicode characters
75 return len;
76}
77
78char *str_tolower
79(

Callers 2

AR_RIGHTFunction · 0.85
AR_SIZEFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected