Lely core libraries  2.3.4
ustring.h File Reference
#include <lely/libc/uchar.h>
#include <assert.h>
#include <stddef.h>
Include dependency graph for ustring.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

size_t str16len (const char16_t *s)
 Returns the number of (16-bit) Unicode characters, excluding the terminating null bytes, in the string at s. More...
 
char16_t * str16ncpy (char16_t *dst, const char16_t *src, size_t n)
 Copies n (16-bit) Unicode characters from the string at src to dst. More...
 
int str16ncmp (const char16_t *s1, const char16_t *s2, size_t n)
 Compares two (16-bit) Unicode strings. More...
 

Detailed Description

This header file is part of the utilities library; it contains (16-bit) Unicode string functions.

Author
J. S. Seldenthuis jseld.nosp@m.enth.nosp@m.uis@l.nosp@m.ely..nosp@m.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file ustring.h.

Function Documentation

◆ str16len()

size_t str16len ( const char16_t *  s)
inline

Returns the number of (16-bit) Unicode characters, excluding the terminating null bytes, in the string at s.

Parameters
sa pointer to the (null-terminated) string.
Returns
the number of characters in the string pointed to by s.

Definition at line 78 of file ustring.h.

◆ str16ncpy()

char16_t * str16ncpy ( char16_t *  dst,
const char16_t *  src,
size_t  n 
)
inline

Copies n (16-bit) Unicode characters from the string at src to dst.

If the string at src is shorter than n characters, NUL characters are appended to the string at dst until n characters haven been written.

Parameters
dstthe destination address, which MUST be large enough to hold the string.
srca pointer to the string to be copied.
nthe number of (16-bit) Unicode characters to copy.
Returns
dst.

Definition at line 88 of file ustring.h.

◆ str16ncmp()

int str16ncmp ( const char16_t *  s1,
const char16_t *  s2,
size_t  n 
)
inline

Compares two (16-bit) Unicode strings.

Parameters
s1a pointer to the first string.
s2a pointer to the second string.
nthe maximum number of characters to compare.
Returns
an integer greater than, equal to, or less than 0 if the string at s1 is greater than, equal to, or less than the string at s2.

Definition at line 100 of file ustring.h.