Blender  V2.93
Functions
string.c File Reference
#include <ctype.h>
#include <inttypes.h>
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "BLI_dynstr.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"

Go to the source code of this file.

Functions

char * BLI_strdupn (const char *str, const size_t len)
 
char * BLI_strdup (const char *str)
 
char * BLI_strdupcat (const char *__restrict str1, const char *__restrict str2)
 
char * BLI_strncpy (char *__restrict dst, const char *__restrict src, const size_t maxncpy)
 
char * BLI_strncpy_ensure_pad (char *__restrict dst, const char *__restrict src, const char pad, size_t maxncpy)
 
size_t BLI_strncpy_rlen (char *__restrict dst, const char *__restrict src, const size_t maxncpy)
 
size_t BLI_strcpy_rlen (char *__restrict dst, const char *__restrict src)
 
size_t BLI_vsnprintf (char *__restrict buffer, size_t maxncpy, const char *__restrict format, va_list arg)
 
size_t BLI_vsnprintf_rlen (char *__restrict buffer, size_t maxncpy, const char *__restrict format, va_list arg)
 
size_t BLI_snprintf (char *__restrict dst, size_t maxncpy, const char *__restrict format,...)
 
size_t BLI_snprintf_rlen (char *__restrict dst, size_t maxncpy, const char *__restrict format,...)
 
char * BLI_sprintfN (const char *__restrict format,...)
 
size_t BLI_str_escape (char *__restrict dst, const char *__restrict src, const size_t dst_maxncpy)
 
size_t BLI_str_unescape (char *__restrict dst, const char *__restrict src, const size_t src_maxncpy)
 
const char * BLI_str_escape_find_quote (const char *str)
 
char * BLI_str_quoted_substrN (const char *__restrict str, const char *__restrict prefix)
 
char * BLI_str_replaceN (const char *__restrict str, const char *__restrict substr_old, const char *__restrict substr_new)
 
void BLI_str_replace_char (char *str, char src, char dst)
 
bool BLI_str_replace_table_exact (char *string, const size_t string_len, const char *replace_table[][2], int replace_table_len)
 
int BLI_strcaseeq (const char *a, const char *b)
 
char * BLI_strcasestr (const char *s, const char *find)
 
int BLI_string_max_possible_word_count (const int str_len)
 
bool BLI_string_has_word_prefix (const char *haystack, const char *needle, size_t needle_len)
 
bool BLI_string_all_words_matched (const char *name, const char *str, int(*words)[2], const int words_len)
 
char * BLI_strncasestr (const char *s, const char *find, size_t len)
 
int BLI_strcasecmp (const char *s1, const char *s2)
 
int BLI_strncasecmp (const char *s1, const char *s2, size_t len)
 
static int left_number_strcmp (const char *s1, const char *s2, int *tiebreaker)
 
int BLI_strcasecmp_natural (const char *s1, const char *s2)
 
int BLI_strcmp_ignore_pad (const char *str1, const char *str2, const char pad)
 
size_t BLI_strnlen (const char *s, const size_t maxlen)
 
void BLI_str_tolower_ascii (char *str, const size_t len)
 
void BLI_str_toupper_ascii (char *str, const size_t len)
 
void BLI_str_rstrip (char *str)
 
int BLI_str_rstrip_float_zero (char *str, const char pad)
 
int BLI_str_index_in_array_n (const char *__restrict str, const char **__restrict str_array, const int str_array_len)
 
int BLI_str_index_in_array (const char *__restrict str, const char **__restrict str_array)
 
bool BLI_str_startswith (const char *__restrict str, const char *__restrict start)
 
bool BLI_strn_endswith (const char *__restrict str, const char *__restrict end, size_t slength)
 
bool BLI_str_endswith (const char *__restrict str, const char *__restrict end)
 
size_t BLI_str_partition (const char *str, const char delim[], const char **sep, const char **suf)
 
size_t BLI_str_rpartition (const char *str, const char delim[], const char **sep, const char **suf)
 
size_t BLI_str_partition_ex (const char *str, const char *end, const char delim[], const char **sep, const char **suf, const bool from_right)
 
static size_t BLI_str_format_int_grouped_ex (char src[16], char dst[16], int num_len)
 
size_t BLI_str_format_int_grouped (char dst[16], int num)
 
size_t BLI_str_format_uint64_grouped (char dst[16], uint64_t num)
 
void BLI_str_format_byte_unit (char dst[15], long long int bytes, const bool base_10)
 
int BLI_string_find_split_words (const char *str, const size_t len, const char delim, int r_words[][2], int words_max)
 

Function Documentation

◆ BLI_snprintf()

size_t BLI_snprintf ( char *__restrict  dst,
size_t  maxncpy,
const char *__restrict  format,
  ... 
)

Portable replacement for snprintf

Definition at line 264 of file string.c.

References BLI_vsnprintf().

◆ BLI_snprintf_rlen()

size_t BLI_snprintf_rlen ( char *__restrict  dst,
size_t  maxncpy,
const char *__restrict  format,
  ... 
)

A version of BLI_snprintf that returns strlen(dst)

Definition at line 283 of file string.c.

References BLI_vsnprintf_rlen().

Referenced by BLI_str_format_byte_unit().

◆ BLI_sprintfN()

char* BLI_sprintfN ( const char *__restrict  format,
  ... 
)

Print formatted string into a newly MEM_mallocN'd string and return it.

Definition at line 303 of file string.c.

References BLI_dynstr_free(), BLI_dynstr_get_cstring(), BLI_dynstr_new(), and BLI_dynstr_vappendf().

◆ BLI_str_endswith()

bool BLI_str_endswith ( const char *__restrict  str,
const char *__restrict  end 
)

Find if a string ends with another string.

Parameters
strThe string to search within.
endThe string we look for at the end.
Returns
If str ends with end.

Definition at line 1040 of file string.c.

References BLI_strn_endswith(), and str.

Referenced by check_valid_camera_multiview(), menu_items_from_ui_create(), replace_bbone_scale_rnapath(), and update_mapping_node_fcurve_rna_path_callback().

◆ BLI_str_escape()

size_t BLI_str_escape ( char *__restrict  dst,
const char *__restrict  src,
const size_t  dst_maxncpy 
)

This roughly matches C and Python's string escaping with double quotes - ".

Since every character may need escaping, it's common to create a buffer twice as large as the input.

Parameters
dstThe destination string, at least dst_maxncpy, typically (strlen(src) * 2) + 1.
srcThe un-escaped source string.
dst_maxncpyThe maximum number of bytes allowable to copy.
Note
This is used for creating animation paths in blend files.

Definition at line 333 of file string.c.

References BLI_assert, Freestyle::c, ELEM, len, and UNLIKELY.

Referenced by action_flip_pchan(), action_flip_pchan_rna_paths(), bc_enable_fcurves(), BKE_action_fix_paths_rename(), BKE_animdata_fix_paths_rename(), BKE_animsys_fix_rna_path_rename(), BKE_linestyle_path_to_color_ramp(), BKE_object_modifier_gpencil_use_time(), BKE_object_modifier_use_time(), BKE_object_shaderfx_use_time(), BKE_tracking_get_rna_path_for_plane_track(), BKE_tracking_get_rna_path_for_track(), BKE_tracking_get_rna_path_prefix_for_plane_track(), BKE_tracking_get_rna_path_prefix_for_track(), bpy_escape_identifier(), do_version_hue_sat_node(), do_versions_after_linking_290(), draw_property_for_socket(), drw_uniform_attribute_lookup(), get_rna_access(), ArmatureImporter::get_rna_path_for_joint(), nodeRemoveNode(), RNA_path_append(), RNA_path_from_ID_to_property_index(), RNA_path_full_ID_py(), RNA_property_as_string(), seq_convert_transform_crop(), seq_convert_transform_crop_2(), sequencer_rna_path_prefix(), shapekey_adrcodes_to_paths(), StringEscape::testEscapeWords(), update_mapping_node_fcurve_rna_path_callback(), and update_mapping_node_inputs_and_properties().

◆ BLI_str_escape_find_quote()

const char* BLI_str_escape_find_quote ( const char *  str)

Find the first un-escaped quote in the string (to find the end of the string).

Parameters
strTypically this is the first character in a quoted string. Where the character before *str would be ".
Returns
The pointer to the first un-escaped quote.

Definition at line 410 of file string.c.

References NULL, and str.

Referenced by action_flip_pchan_rna_paths(), BLI_str_quoted_substrN(), and rna_path_token().

◆ BLI_str_format_byte_unit()

void BLI_str_format_byte_unit ( char  dst[15],
long long int  bytes,
const bool  base_10 
)

Format a size in bytes using binary units. 1000 -> 1 KB Number of decimal places grows with the used unit (e.g. 1.5 MB, 1.55 GB, 1.545 TB).

Parameters
dstThe resulting string. Dimension of 14 to support largest possible value for bytes (#LLONG_MAX).
bytesNumber to format.
base_10Calculate using base 10 (GB, MB, ...) or 2 (GiB, MiB, ...).

Definition at line 1206 of file string.c.

References ARRAY_SIZE, BLI_snprintf_rlen(), BLI_STATIC_ASSERT, BLI_str_rstrip_float_zero(), BLI_strncpy(), fabs(), len, MAX2, and order.

Referenced by BKE_ptcache_update_info(), BLI_filelist_entry_size_to_string(), EEVEE_lightcache_info_update(), info_statusbar_string(), blender::HashTableStats::print(), blender::Vector< T, InlineBufferCapacity, Allocator >::print_stats(), and TEST().

◆ BLI_str_format_int_grouped()

size_t BLI_str_format_int_grouped ( char  dst[16],
int  num 
)

Format ints with decimal grouping. 1000 -> 1,000

Parameters
dstThe resulting string
numNumber to format
Returns
The length of dst

Definition at line 1170 of file string.c.

References BLI_str_format_int_grouped_ex().

Referenced by BKE_ptcache_update_info(), outliner_draw_userbuts(), spreadsheet_footer_region_draw(), and TEST().

◆ BLI_str_format_int_grouped_ex()

static size_t BLI_str_format_int_grouped_ex ( char  src[16],
char  dst[16],
int  num_len 
)
static

Definition at line 1138 of file string.c.

Referenced by BLI_str_format_int_grouped(), and BLI_str_format_uint64_grouped().

◆ BLI_str_format_uint64_grouped()

size_t BLI_str_format_uint64_grouped ( char  dst[16],
uint64_t  num 
)

Format uint64_t with decimal grouping. 1000 -> 1,000

Parameters
dstThe resulting string
numNumber to format
Returns
The length of dst

Definition at line 1186 of file string.c.

References BLI_str_format_int_grouped_ex(), and PRIu64.

◆ BLI_str_index_in_array()

int BLI_str_index_in_array ( const char *__restrict  str,
const char **__restrict  str_array 
)

Return index of a string in a string array.

Parameters
strThe string to find.
str_arrayArray of strings, (must be NULL-terminated).
Returns
The index of str in str_array or -1.

Definition at line 986 of file string.c.

References str, and STREQ.

Referenced by bpyunits_validate().

◆ BLI_str_index_in_array_n()

int BLI_str_index_in_array_n ( const char *__restrict  str,
const char **__restrict  str_array,
const int  str_array_len 
)

Return index of a string in a string array.

Parameters
strThe string to find.
str_arrayArray of strings.
str_array_lenThe length of the array, or -1 for a NULL-terminated array.
Returns
The index of str in str_array or -1.

Definition at line 964 of file string.c.

References str, and STREQ.

◆ BLI_str_partition()

size_t BLI_str_partition ( const char *  str,
const char  delim[],
const char **  sep,
const char **  suf 
)

Find the first char matching one of the chars in delim, from left.

Parameters
strThe string to search within.
delimThe set of delimiters to search for, as unicode values.
sepReturn value, set to the first delimiter found (or NULL if none found).
sufReturn value, set to next char after the first delimiter found (or NULL if none found).
Returns
The length of the prefix (i.e. *sep - str).

Definition at line 1056 of file string.c.

References BLI_str_partition_ex(), NULL, and str.

Referenced by passtype_from_name(), and TEST().

◆ BLI_str_partition_ex()

size_t BLI_str_partition_ex ( const char *  str,
const char *  end,
const char  delim[],
const char **  sep,
const char **  suf,
const bool  from_right 
)

Find the first char matching one of the chars in delim, either from left or right.

Parameters
strThe string to search within.
endIf non-NULL, the right delimiter of the string.
delimThe set of delimiters to search for, as unicode values.
sepReturn value, set to the first delimiter found (or NULL if none found).
sufReturn value, set to next char after the first delimiter found (or NULL if none found).
from_rightIf true, search from the right of str, else, search from its left.
Returns
The length of the prefix (i.e. *sep - str).

Definition at line 1088 of file string.c.

References BLI_assert, Freestyle::c, NULL, and str.

Referenced by BLI_str_partition(), and BLI_str_rpartition().

◆ BLI_str_quoted_substrN()

char* BLI_str_quoted_substrN ( const char *__restrict  str,
const char *__restrict  prefix 
)

Makes a copy of the text within the "" that appear after some text blahblah. i.e. for string pose["apples"] with prefix pose[, it will return apples.

Parameters
stris the entire string to chop.
prefixis the part of the string to step over.

Assume that the strings returned must be freed afterwards, and that the inputs will contain data we want.

Definition at line 432 of file string.c.

References BLI_str_escape_find_quote(), BLI_str_unescape(), MEM_mallocN, MEM_reallocN, NULL, result, and str.

Referenced by animchan_sync_fcurve_scene(), autokeyframe_pose(), BKE_fcurves_filter(), clear_anim_v3d_exec(), copy_animedit_keys(), delete_key_v3d_exec(), BCAnimationCurve::get_animation_name(), getname_anim_fcurve(), pose_select_same_keyingset(), and skip_fcurve_selected_data().

◆ BLI_str_replace_char()

void BLI_str_replace_char ( char *  str,
char  src,
char  dst 
)

In-place replace every src to dst in str.

Parameters
strThe string to operate on.
srcThe character to replace.
dstThe character to replace with.

Definition at line 532 of file string.c.

References str.

Referenced by BLI_path_abs(), BLI_path_rel(), BLI_path_slash_native(), BLI_path_to_display_name(), blender::gpu::GPUPlatformGlobal::create_gpu_name(), blender::gpu::GPUPlatformGlobal::create_key(), make_element_name(), memiter_words10k_test(), and uri_from_filename().

◆ BLI_str_replace_table_exact()

bool BLI_str_replace_table_exact ( char *  string,
const size_t  string_len,
const char *  replace_table[][2],
int  replace_table_len 
)

Simple exact-match string replacement.

Parameters
replace_tableArray of source, destination pairs.
Note
Larger tables should use a hash table.

Definition at line 549 of file string.c.

References BLI_strncpy(), and STREQ.

Referenced by blo_do_versions_userdef().

◆ BLI_str_replaceN()

char* BLI_str_replaceN ( const char *__restrict  str,
const char *__restrict  substr_old,
const char *__restrict  substr_new 
)

string with all instances of substr_old replaced with substr_new, Returns a copy of the c-string str into a newly MEM_mallocN'd and returns it.

Note
A rather wasteful string-replacement utility, though this shall do for now... Feel free to replace this with an even safe + nicer alternative
Parameters
strThe string to replace occurrences of substr_old in
substr_oldThe text in the string to find and replace
substr_newThe text in the string to find and replace
Return values
Returnsthe duplicated string

Definition at line 470 of file string.c.

References BLI_assert, BLI_dynstr_append(), BLI_dynstr_free(), BLI_dynstr_get_cstring(), BLI_dynstr_nappend(), BLI_dynstr_new(), BLI_strdup(), NULL, and str.

Referenced by replace_bbone_easing_rnapath(), and updateDuplicateActionConstraintSettings().

◆ BLI_str_rpartition()

size_t BLI_str_rpartition ( const char *  str,
const char  delim[],
const char **  sep,
const char **  suf 
)

Find the first char matching one of the chars in delim, from right.

Parameters
strThe string to search within.
delimThe set of delimiters to search for, as unicode values.
sepReturn value, set to the first delimiter found (or NULL if none found).
sufReturn value, set to next char after the first delimiter found (or NULL if none found).
Returns
The length of the prefix (i.e. *sep - str).

Definition at line 1071 of file string.c.

References BLI_str_partition_ex(), NULL, and str.

Referenced by BKE_scene_multiview_view_prefix_get(), imb_exr_insert_view_name(), and TEST().

◆ BLI_str_rstrip()

void BLI_str_rstrip ( char *  str)

Strip whitespace from end of the string.

Definition at line 915 of file string.c.

References str.

Referenced by ED_area_status_text(), and fsmenu_xdg_user_dirs_parse().

◆ BLI_str_rstrip_float_zero()

int BLI_str_rstrip_float_zero ( char *  str,
const char  pad 
)

Strip trailing zeros from a float, eg: 0.0000 -> 0.0 2.0010 -> 2.001

Parameters
str
pad
Returns
The number of zeros stripped.

Definition at line 936 of file string.c.

References str.

Referenced by ANIM_add_driver(), BLI_str_format_byte_unit(), ui_but_copy_numeric_value(), and ui_textedit_begin().

◆ BLI_str_startswith()

bool BLI_str_startswith ( const char *__restrict  str,
const char *__restrict  start 
)

Find if a string starts with another string.

Parameters
strThe string to search within.
startThe string we look for at the start.
Returns
If str starts with start.

Definition at line 1006 of file string.c.

References str.

Referenced by blo_do_versions_280(), codegen_process_uniforms_functions(), count_active_texture_sampler(), and gpu_parse_material_library().

◆ BLI_str_tolower_ascii()

void BLI_str_tolower_ascii ( char *  str,
const size_t  len 
)

◆ BLI_str_toupper_ascii()

void BLI_str_toupper_ascii ( char *  str,
const size_t  len 
)

Definition at line 901 of file string.c.

References len, and str.

Referenced by WM_operator_bl_idname().

◆ BLI_str_unescape()

size_t BLI_str_unescape ( char *__restrict  dst,
const char *__restrict  src,
const size_t  src_maxncpy 
)

This roughly matches C and Python's string escaping with double quotes - ".

The destination will never be larger than the source, it will either be the same or up to half when all characters are escaped.

Parameters
dstThe destination string, at least the size of strlen(src) + 1.
srcThe escaped source string.
dst_maxncpyThe maximum number of bytes allowable to copy.
Note
This is used for for parsing animation paths in blend files.

Definition at line 375 of file string.c.

References Freestyle::c, and len.

Referenced by action_flip_pchan_rna_paths(), BLI_str_quoted_substrN(), bpy_unescape_identifier(), rna_path_token(), and StringEscape::testEscapeWords().

◆ BLI_strcasecmp()

int BLI_strcasecmp ( const char *  s1,
const char *  s2 
)

◆ BLI_strcasecmp_natural()

int BLI_strcasecmp_natural ( const char *  s1,
const char *  s2 
)

◆ BLI_strcaseeq()

int BLI_strcaseeq ( const char *  a,
const char *  b 
)

Compare two strings without regard to case.

Return values
Trueif the strings are equal, false otherwise.

Definition at line 570 of file string.c.

References Freestyle::a, and BLI_strcasecmp().

Referenced by imb_exr_split_channel_name(), and ExtraHandler::parseElement().

◆ BLI_strcasestr()

char* BLI_strcasestr ( const char *  s,
const char *  find 
)

◆ BLI_strcmp_ignore_pad()

int BLI_strcmp_ignore_pad ( const char *  str1,
const char *  str2,
const char  pad 
)

Like strcmp, but will ignore any heading/trailing pad char for comparison. So e.g. if pad is '*', 'world' and 'world' will compare equal.

Definition at line 837 of file string.c.

References ret.

Referenced by filelist_setfilter_options().

◆ BLI_strcpy_rlen()

size_t BLI_strcpy_rlen ( char *__restrict  dst,
const char *__restrict  src 
)

◆ BLI_strdup()

char* BLI_strdup ( const char *  str)

Duplicates the cstring str into a newly mallocN'd string and returns it.

Parameters
strThe string to be duplicated
Return values
Returnsthe duplicated string

Definition at line 70 of file string.c.

References BLI_strdupn(), and str.

Referenced by actkeys_paste_description(), add_driver_with_target(), alloc_driver_fcurve(), BKE_appdir_app_templates(), BKE_collection_new_name_get(), BKE_gpencil_modifier_set_error(), BKE_id_to_unique_string_key(), BKE_keyingset_add_path(), BKE_lib_override_library_property_get(), BKE_lib_override_library_property_operation_get(), BKE_modifier_set_error(), BKE_object_sync_to_original(), BKE_packedfile_unpack_to_file(), BKE_previewimg_cached_ensure(), BKE_previewimg_cached_thumbnail_read(), BKE_render_result_stamp_data(), bke_view_layer_verify_aov_cb(), BLF_dir_add(), BLF_dir_get(), blf_dir_metrics_search(), blf_dir_search(), blf_font_new(), blf_font_new_from_mem(), bli_builddir(), BLI_cpu_brand_string(), BLI_filename_make_safe(), BLI_str_replaceN(), BLO_blendhandle_get_datablock_names(), BLO_blendhandle_get_linkable_groups(), BLT_lang_init(), BLT_lang_locale_explode(), BMO_op_vinitf(), build_pict_list_ex(), console_lb_add_str__internal(), ED_action_fcurve_ensure(), ED_armature_join_objects_exec(), ED_fsmenu_entry_set_path(), ED_gpencil_join_objects_exec(), ED_image_save_all_modified_info(), ED_spreadsheet_set_geometry_node_context(), eevee_get_frag(), file_draw_icon(), file_draw_preview(), file_draw_tooltip_func(), file_exec(), filelist_file_create_entry(), filelist_readjob_do(), filelist_readjob_list_lib(), filelist_readjob_main_assets(), folderlist_pushdir(), fsmenu_insert_entry(), fsmenu_xdg_user_dirs_parse(), GPU_generate_pass(), gpu_node_graph_add_volume_grid(), graphkeys_decimate_desc(), graphkeys_paste_description(), headerTranslation(), icu_to_fcurves(), IMB_anim_index_rebuild_context(), IMB_thumb_path_lock(), lib_override_library_property_copy(), lib_override_library_property_operation_copy(), modifier_apply_as_shapekey_get_description(), AnimationImporter::modify_fcurve(), pyrna_struct_anim_args_parse_ex(), RE_engine_set_error_message(), rewrite_path_alloc(), RNA_path_back(), RNA_path_from_ID_to_struct(), RNA_path_resolve_from_type_to_property(), RNA_path_struct_property_py(), RNA_pointer_as_string(), rna_pointer_as_string__bldata(), RNA_pointer_as_string_keywords_ex(), rna_prepend_real_ID_path(), run_string_handle_error(), screen_opengl_render_description(), blender::ed::spreadsheet::spreadsheet_column_id_copy(), blender::ed::spreadsheet::spreadsheet_context_modifier_copy(), blender::ed::spreadsheet::spreadsheet_context_node_copy(), str_ghash_tests(), strip_last_slash(), text_convert_whitespace_exec(), text_copy_data(), text_save_as_exec(), track_markers_desc(), ui_apply_but_TEX(), ui_but_add_shortcut(), ui_but_convert_to_unit_alt_name(), ui_but_rna_menu_convert_to_menu_type(), ui_but_rna_menu_convert_to_panel_type(), ui_but_string_get_dynamic(), UI_but_string_info_get(), ui_rna_collection_search_update_fn(), ui_tooltip_data_from_button(), ui_tooltip_data_from_gizmo(), ui_tooltip_data_from_search_item_tooltip_data(), ui_tooltip_data_from_tool(), uiItemFullOMenuHold_ptr(), volume_grid_cache_get(), wm_history_file_new(), wm_history_file_read(), wm_link_append_exec(), WM_operatortype_description(), WM_operatortype_description_or_name(), and wm_save_as_mainfile_get_description().

◆ BLI_strdupcat()

char* BLI_strdupcat ( const char *__restrict  str1,
const char *__restrict  str2 
)

Appends the two strings, and returns new mallocN'ed string

Parameters
str1first string for copy
str2second string for append
Return values
Returnsdst

Definition at line 81 of file string.c.

References MEM_mallocN, and str.

Referenced by bli_builddir(), BLT_lang_locale_explode(), filelist_file_create_entry(), GPU_generate_pass(), GPU_shader_create_from_python(), and replace_bbone_scale_rnapath().

◆ BLI_strdupn()

char* BLI_strdupn ( const char *  str,
const size_t  len 
)

Duplicates the first len bytes of cstring str into a newly mallocN'd string and returns it. str is assumed to be at least len bytes long.

Parameters
strThe string to be duplicated
lenThe number of bytes to duplicate
Return values
Returnsthe duplicated string

Definition at line 54 of file string.c.

References len, MEM_mallocN, and str.

Referenced by BKE_nlastrip_validate_fcurves(), BLI_file_read_as_lines(), BLI_strdup(), block_create__close_file_dialog(), BLT_lang_locale_explode(), BLT_lang_set(), console_lb_add__internal(), do_version_fcurve_hide_viewport_fix(), fsmenu_insert_entry(), ibJpegImageFromCinfo(), memiter_words10k_test(), node_errors_tooltip_fn(), TEST(), text_autocomplete_build(), txt_insert_buf(), ui_but_string_get_dynamic(), UI_but_string_info_get(), ui_number_from_string_factor(), ui_number_from_string_percentage(), and ui_textedit_begin().

◆ BLI_string_all_words_matched()

bool BLI_string_all_words_matched ( const char *  name,
const char *  str,
int(*)  words[2],
const int  words_len 
)

Definition at line 616 of file string.c.

References BLI_string_has_word_prefix(), and str.

Referenced by operator_search_update_fn().

◆ BLI_string_find_split_words()

int BLI_string_find_split_words ( const char *  str,
const size_t  len,
const char  delim,
int  r_words[][2],
int  words_max 
)

Find the ranges needed to split str into its individual words.

Parameters
strThe string to search for words.
lenSize of the string to search.
delimCharacter to use as a delimiter.
r_wordsInfo about the words found. Set to [index, len] pairs.
words_maxMax number of words to find
Returns
The number of words found in str

Definition at line 1242 of file string.c.

References len, and str.

Referenced by name_matches_dopesheet_filter(), operator_search_update_fn(), and StringFindSplitWords::testStringFindSplitWords().

◆ BLI_string_has_word_prefix()

bool BLI_string_has_word_prefix ( const char *  haystack,
const char *  needle,
size_t  needle_len 
)

◆ BLI_string_max_possible_word_count()

int BLI_string_max_possible_word_count ( const int  str_len)

Definition at line 599 of file string.c.

Referenced by name_matches_dopesheet_filter(), operator_search_update_fn(), and TEST().

◆ BLI_strn_endswith()

bool BLI_strn_endswith ( const char *__restrict  str,
const char *__restrict  end,
size_t  slength 
)

◆ BLI_strncasecmp()

int BLI_strncasecmp ( const char *  s1,
const char *  s2,
size_t  len 
)

Definition at line 689 of file string.c.

References len.

Referenced by BLI_strcasestr(), BLI_strncasestr(), texttool_suggest_add(), and texttool_suggest_prefix().

◆ BLI_strncasestr()

char* BLI_strncasestr ( const char *  s,
const char *  find,
size_t  len 
)

Variation of BLI_strcasestr with string length limited to len

Definition at line 635 of file string.c.

References BLI_strncasecmp(), Freestyle::c, len, and NULL.

Referenced by BLI_string_has_word_prefix(), name_matches_dopesheet_filter(), and TEST().

◆ BLI_strncpy()

char* BLI_strncpy ( char *__restrict  dst,
const char *__restrict  src,
const size_t  maxncpy 
)

Like strncpy but ensures dst is always '\0' terminated.

Parameters
dstDestination for copy
srcSource string to copy
maxncpyMaximum number of characters to copy (generally the size of dst)
Return values
Returnsdst

Definition at line 108 of file string.c.

References BLI_assert, and BLI_strnlen().

Referenced by ABC_export(), ABC_import(), acf_filldrivers_name(), acf_generic_idblock_name(), acf_gpl_name(), acf_group_name(), acf_masklay_name(), acf_nla_controls_name(), acf_nlaaction_name(), acf_nlatrack_name(), acf_object_name(), acf_shapekey_name(), acf_summary_name(), action_groups_add_new(), AnimationImporter::add_bone_fcurve(), add_driver_with_target(), add_hook_object(), add_new_constraint_internal(), blender::io::alembic::AbcObjectReader::addCacheModifier(), addMatrixSpace(), ANIM_add_driver(), ANIM_channel_debug_print_info(), ANIM_copy_as_driver(), anim_getnew(), ANIM_keyingset_info_register(), AnimationImporter::apply_matrix_curves(), applyTransformOrientation(), blender::io::alembic::ArchiveReader::ArchiveReader(), arg_handle_load_file(), arg_handle_output_set(), arg_handle_python_file_run(), armature_autoside_names_exec(), armature_extrude_exec(), asset_metadata_tag_add(), AnimationImporter::Assign_color_animations(), AnimationImporter::Assign_float_animations(), AnimationImporter::Assign_lens_animations(), AnimationImporter::Assign_transform_animations(), attribute_search_exec_fn(), BKE_addon_ensure(), BKE_appdir_folder_documents(), BKE_blendfile_write_partial(), BKE_bpath_relocate_visitor(), BKE_cachefile_eval(), BKE_cachefile_filepath_get(), BKE_collection_new_name_get(), BKE_color_managed_colorspace_settings_copy(), BKE_color_managed_colorspace_settings_init(), BKE_color_managed_display_settings_copy(), BKE_color_managed_display_settings_init(), BKE_color_managed_view_settings_copy(), BKE_cryptomatte_find_name(), BKE_curve_init(), BKE_fluid_modifier_copy(), BKE_freestyle_lineset_add(), BKE_gpencil_layer_addnew(), BKE_gpencil_layer_mask_add(), BKE_gpencil_modifier_new(), BKE_gpencil_palette_addnew(), BKE_gpencil_palettecolor_addnew(), BKE_id_new_name_validate(), BKE_image_add_renderslot(), BKE_image_add_tile(), BKE_image_get_tile_label(), BKE_image_save(), BKE_image_user_file_path(), BKE_keyblock_add(), BKE_keyblock_copy_settings(), BKE_keyingset_add(), BKE_keyingset_add_path(), BKE_lib_override_library_update(), BKE_libblock_alloc(), BKE_libblock_copy_ex(), BKE_library_filepath_set(), BKE_mask_layer_copy(), BKE_mask_layer_new(), BKE_mask_layer_rename(), BKE_mask_new(), BKE_memfile_undo_decode(), BKE_memfile_undo_encode(), BKE_modifier_new(), BKE_movieclip_file_add(), BKE_movieclip_file_add_exists_ex(), BKE_movieclip_filename_for_frame(), BKE_nla_action_stash(), BKE_nlastrip_validate_name(), BKE_node_clipboard_add_node(), BKE_object_copy_gpencil_modifier(), BKE_object_copy_modifier(), BKE_object_defgroup_new(), BKE_object_facemap_add_name(), BKE_object_modifier_stack_copy(), BKE_object_workob_calc_parent(), BKE_packedfile_compare_to_file(), BKE_packedfile_new(), BKE_packedfile_unpack_image(), BKE_packedfile_unpack_sound(), BKE_packedfile_unpack_to_file(), BKE_packedfile_unpack_vfont(), BKE_packedfile_unpack_volume(), BKE_pose_add_group(), BKE_pose_channel_verify(), BKE_preferences_asset_library_add(), BKE_ptcache_disk_cache_rename(), BKE_ptcache_id_clear(), BKE_ptcache_load_external(), BKE_ptcache_update_info(), BKE_scene_add_render_view(), BKE_scene_disable_color_management(), BKE_scene_multiview_filepath_get(), BKE_scene_multiview_view_filepath_get(), BKE_scene_multiview_view_prefix_get(), BKE_shaderfx_new(), BKE_sim_debug_data_add_element(), BKE_sound_new_file(), BKE_sound_new_file_exists_ex(), BKE_studiolight_init(), BKE_text_file_modified_check(), BKE_text_file_modified_ignore(), BKE_text_load_ex(), BKE_text_reload(), BKE_tracking_get_rna_path_prefix_for_plane_track(), BKE_tracking_get_rna_path_prefix_for_track(), BKE_tracking_object_add(), BKE_tracking_reconstruction_check(), BKE_tracking_reconstruction_context_new(), BKE_tracking_reconstruction_report_error_message(), BKE_undosys_step_push_init_with_type(), BKE_undosys_step_push_with_type(), BKE_vfont_load(), BKE_vfont_load_exists_ex(), BKE_view_layer_add_aov(), BKE_view_layer_rename(), BKE_volume_load(), blf_dir_search(), bli_builddir(), BLI_dir_create_recursive(), BLI_filelist_entry_mode_to_string(), BLI_filelist_entry_owner_to_string(), BLI_hostname_get(), BLI_join_dirfile(), BLI_make_file_string(), BLI_path_abs(), BLI_path_abs_from_cwd(), BLI_path_append(), BLI_path_extension_check_glob(), BLI_path_frame(), BLI_path_frame_range(), BLI_path_frame_strip(), BLI_path_program_search(), BLI_path_rel(), BLI_path_sequence_decode(), BLI_path_suffix(), BLI_path_to_display_name(), BLI_split_dirfile(), BLI_str_format_byte_unit(), BLI_str_replace_table_exact(), BLI_string_flip_side_name(), BLI_string_split_prefix(), BLI_string_split_suffix(), BLI_uniquename_cb(), blo_do_versions_260(), blo_do_versions_270(), blo_do_versions_280(), blo_do_versions_290(), blo_filedata_from_file(), blo_find_main(), blo_read_file_internal(), BLO_read_from_memfile(), blo_update_defaults_scene(), BLO_update_defaults_startup_blend(), BMO_op_vinitf(), boid_new_rule(), bone_autoside_name(), bone_mouse_select_menu(), bookmark_select_exec(), bpath_list_restore(), bpath_relative_rebase_visit_cb(), bpy_lib_enter(), bpy_lib_load(), bpy_lib_write(), bpyunits_to_value(), build_pict_list_ex(), cache_file_init_data(), cachefile_open_exec(), cachefile_open_invoke(), calculatePropRatio(), cdf_layer_add(), check_for_dupid(), cmp_node_image_add_pass_output(), colormanage_check_colorspace_settings(), colormanage_check_display_settings(), colormanage_check_view_settings(), colormanage_colorspace_add(), colormanage_display_add(), colormanage_look_add(), colormanage_role_color_space_name_get(), colormanage_view_add(), colorspace_set_default_role(), constraint_bone_name_fix(), blender::io::alembic::create_archive(), create_placeholder(), CTX_store_add(), curve_calc_modifiers_post(), customData_add_layer__internal(), CustomData_external_add(), customdata_external_filename(), CustomData_set_layer_name(), CustomData_validate_layer_name(), depthdropper_depth_sample_pt(), detect_clip_source(), direct_link_library(), do_makepicstring(), do_version_constraints_245(), do_versions(), do_versions_compositor_render_passes_storage(), do_versions_node_group_add_socket_2_56_2(), do_versions_nodetree_customnodes(), do_versions_nodetree_file_output_layers_2_64_5(), do_versions_nodetree_multi_file_output_format_2_62_1(), do_versions_nodetree_multi_file_output_path_2_63_1(), do_write_image_or_movie(), draw_marker_texts(), draw_movieclip_notes(), draw_seq_text_get_source(), drivers_path_rename_fix(), DRW_draw_region_engine_info(), DRW_pass_create(), DRW_shader_library_add_file(), DRW_stats_draw(), drw_stats_timer_start_ex(), duplicateEditBoneObjects(), dynamicPaint_bakeImageSequence(), dynamicPaint_Modifier_copy(), dynamicPaint_outputSurfaceImage(), dynamicPaintSurface_setUniqueName(), dynamicPaintSurface_updateType(), ED_area_status_text(), ED_armature_bone_rename(), ED_armature_bones_flip_names(), ED_armature_ebone_add(), ED_armature_from_edit(), ED_armature_join_objects_exec(), ED_buttons_search_string_set(), ED_file_change_dir_ex(), ED_fsmenu_entry_set_name(), ED_gpencil_anim_copybuf_copy(), ED_image_filesel_detect_sequences(), ed_marker_duplicate_apply(), ED_node_set_tree_type(), ED_node_tree_push(), ED_node_tree_start(), ED_object_parent(), ED_object_parent_set(), ED_object_shaderfx_copy(), ED_sequencer_select_sequence_single(), ED_workspace_status_text(), EEVEE_lightcache_info_update(), external_draw_scene_do(), extract_tan_ex(), eyedropper_gpencil_status_indicators(), fcurve_add_to_list(), fcurves_path_rename_fix(), file_browse_exec(), file_directory_enter_handle(), file_directory_new_exec(), file_draw_string(), file_expand_directory(), file_filename_enter_handle(), file_panel_operator_header(), file_path_to_ui_path(), file_rename_state_activate(), file_select_match(), file_sfile_filepath_set(), filelist_cache_previews_push(), filelist_get_details_column_string(), filelist_readjob_do(), filelist_readjob_start(), filelist_setdir(), filelist_setfilter_options(), blender::io::gpencil::GpencilIO::filename_set(), filenum_newname(), fileselect_ensure_updated_file_params(), fileselect_file_set(), fileselect_initialize_params_common(), fileselect_refresh_asset_params(), find_bhead_from_code_name(), fix_relpaths_library(), flip_names(), fluid_bake_sequence(), fluid_initjob(), fluid_validatepaths(), fmodifier_panel_register(), fmodifier_subpanel_register(), folderlist_popdir(), blender::gpu::FrameBuffer::FrameBuffer(), fsmenu_entry_generate_name(), fsmenu_insert_entry(), fsmenu_read_bookmarks(), gather_objects_paths(), generator_panel_draw(), get_index_dir(), get_path_system_ex(), get_path_user_ex(), get_proxy_fname(), get_sequence_fname(), Freestyle::StringUtils::getPathName(), Freestyle::BlenderStrokeRenderer::GetStrokeShader(), ghost_event_proc(), gpencil_duplicate_exec(), gpencil_duplicate_points(), gpencil_interpolate_status_indicators(), gpencil_modifier_panel_register(), gpencil_modifier_subpanel_register(), gpencil_primitive_status_indicators(), gpencil_strokes_copy_exec(), groupname_to_code(), hud_panel_operator_redo_draw_header(), icon_preview_imbuf_from_brush(), id_name_final_build(), IDP_AssignString(), idp_generic_copy(), IDP_NewIDPArray(), IDP_NewString(), idriver_to_cdriver(), image_replace_exec(), image_save_options_init(), image_save_post(), image_save_sequence_exec(), image_sequence_get_frame_ranges(), IMB_anim_get_fname(), IMB_anim_set_index_dir(), imb_cache_filename(), IMB_colormanagement_check_file_config(), IMB_colormanagement_colorspace_from_ibuf_ftype(), IMB_colormanagement_init_default_view_settings(), IMB_colormanagement_validate_settings(), IMB_exr_add_channel(), imb_exr_begin_read_mem(), IMB_exr_channel_rect(), IMB_exr_get_handle_name(), imb_exr_get_layer(), imb_exr_get_pass(), imb_exr_insert_view_name(), IMB_exr_set_channel(), imb_exr_split_channel_name(), imb_handle_alpha(), IMB_ibImageFromFile(), IMB_ibImageFromMemory(), IMB_index_builder_create(), IMB_indexer_open(), imb_load_photoshop(), IMB_loadiffname(), IMB_metadata_get_field(), IMB_moviecache_create(), IMB_open_anim(), IMB_suffix_anim(), IMB_testiffname(), init_iconfile_list(), init_output_file(), init_text_effect(), initLaplacianSystem(), is_hidden_dot_filename(), joined_armature_fix_animdata_cb(), joined_armature_fix_links(), joined_armature_fix_links_constraints(), label(), lib_relocate_do_remap(), library_link_end(), load_data_init_from_operator(), Freestyle::Controller::LoadMesh(), M_imbuf_load(), main(), make_boneList_recursive(), make_object_duplilist_real(), make_socket(), make_socket_interface(), make_socket_type_virtual(), make_standard_socket_type(), mask_parent_set_exec(), merged_element_search_fn_recursive(), mesh_calc_finalize(), mesh_new_from_mesh(), meshcache_do(), missing_files_find__recursive(), missing_files_find__visit_cb(), ml_addlayer_cb(), ml_addpass_cb(), ml_addview_cb(), modifier_panel_register(), modifier_subpanel_register(), movieclip_open_anim_file(), namebutton_fn(), new_folder_path(), new_modifier(), node_blend_label(), node_boolean_math_label(), node_composit_init_rlayers(), node_draw_reroute(), node_draw_space(), node_filter_label(), node_find_create_label(), node_float_compare_label(), node_group_label(), node_image_label(), node_init(), node_link_update_header(), node_mask_label(), node_math_label(), node_sock_label(), node_socket_copy_default_value(), node_type_base(), node_type_base_custom(), node_type_socket_templates(), node_type_storage(), node_vector_math_label(), nodeAddNode(), nodeLabel(), nodeModifySocketType(), ntreeAddTree(), ntreeCompositCryptomatteLayerPrefix(), object_add_or_copy_particle_system(), object_blend_write(), object_copy_data(), object_mouse_select_menu(), object_speaker_add_exec(), objfnt_to_ftvfontdata(), open_invoke(), operator_search_update_fn(), outputNumInput(), blender::compositor::OutputOpenExrLayer::OutputOpenExrLayer(), blender::compositor::OutputOpenExrMultiLayerOperation::OutputOpenExrMultiLayerOperation(), blender::compositor::OutputSingleLayerOperation::OutputSingleLayerOperation(), blender::compositor::OutputStereoOperation::OutputStereoOperation(), panel_add_instanced(), particle_batch_cache_ensure_procedural_strand_data(), pose_autoside_names_exec(), pose_bone_do_paste(), pose_clear_user_transforms_exec(), pose_slide_draw_status(), poselib_add_exec(), poselib_preview_apply(), poselib_preview_handle_event(), poselib_rename_exec(), preview_prepare_scene(), ptcache_frame_from_filename(), pyrna_py_to_prop(), RE_bake_engine(), RE_create_gp_pass(), RE_engine_render(), RE_engine_update_stats(), RE_NewRender(), RE_SetActiveRenderView(), RE_WriteRenderResult(), RE_WriteRenderViewsImage(), read_global(), read_library_file_data(), blender::io::alembic::AbcNurbsReader::readObjectData(), register_undefined_types(), rename_id_for_versioning(), renamebutton_cb(), render_layer_add_pass(), render_result_exr_file_cache_path(), render_result_new(), render_result_view_new(), render_result_views_shallowcopy(), return_editmesh_vgroup(), rewrite_path_alloc(), rewrite_path_fixed(), rewrite_path_fixed_dirfile(), RNA_parameter_list_create(), RNA_struct_state_owner_set(), save_image_op(), save_set_filepath(), scene_init_data(), screen_opengl_views_setup(), screenshot_invoke(), sculpt_undo_alloc_node_type(), sculpt_undo_bmesh_push(), sculpt_undo_face_sets_push(), SCULPT_undo_push_node(), sculpt_update_cache_invariants(), SEQ_add_image_load_file(), SEQ_add_image_set_directory(), SEQ_add_image_strip(), SEQ_add_load_data_init(), SEQ_add_movie_strip(), seq_add_set_name(), seq_disk_cache_add_file_to_list(), seq_disk_cache_add_header_entry(), seq_disk_cache_get_dir(), seq_disk_cache_get_files(), seq_disk_cache_get_project_dir(), seq_disk_cache_handle_versioning(), SEQ_edit_sequence_swap(), SEQ_modifier_new(), seq_open_anim_file(), seq_proxy_get_custom_file_fname(), seq_proxy_get_fname(), seq_proxy_index_dir_set(), SEQ_sequence_base_unique_name_recursive(), sequence_guess_offset(), sequencer_add_movie_multiple_strips(), sequencer_add_sound_multiple_strips(), sequencer_change_path_exec(), sequencer_export_subtitles_invoke(), sequencer_generic_invoke_path__internal(), sequencer_image_seq_reserve_frames(), sequencer_select_exec(), sequencer_separate_images_exec(), set_constraint_nth_target(), BoneExtended::set_name(), setAxisMatrixConstraint(), setConstraint(), setError(), setNearestAxis2d(), blender::compositor::PlaneTrackCommon::setPlaneTrackName(), blender::compositor::CompositorOperation::setSceneName(), blender::compositor::PlaneTrackCommon::setTrackingObject(), blender::compositor::TrackPositionOperation::setTrackingObject(), blender::compositor::KeyingScreenOperation::setTrackingObject(), blender::compositor::TrackPositionOperation::setTrackName(), setup_app_data(), blender::io::alembic::AbcObjectReader::setupObjectTransform(), blender::gpu::Shader::Shader(), shaderfx_copy_exec(), shaderfx_panel_register(), shaderfx_subpanel_register(), shapekey_adrcodes_to_paths(), sig_handle_crash(), solve_camera_invoke(), solve_camera_updatejob(), sound_mixdown_exec(), split_groups_action_temp(), split_main_newid(), studiolight_add_file(), surface_setUniqueOutputName(), tempdir_session_create(), templates_register_pass_cb(), blender::bke::cryptomatte::tests::TEST(), blender::bke::tests::TEST(), test_env_path(), blender::bke::tests::test_render_pass_conflict(), text_find_set_selected_exec(), text_replace_set_selected_exec(), ExtraHandler::textData(), blender::gpu::Texture::Texture(), tracking_dopesheet_channels_calc(), tracks_map_new(), transform_orientations_current_set(), transformcache_copy(), AnimationImporter::translate_animation_OLD(), txt_new_linen(), txt_sel_to_buf(), txt_to_buf(), txt_write_file(), ubuf_from_image_no_tiles(), ui_apply_but_undo(), UI_autocomplete_end(), UI_autocomplete_update_name(), UI_block_begin(), ui_but_anim_expression_get(), ui_but_copy_operator(), UI_but_drag_set_asset(), ui_but_string_get_ex(), ui_but_string_set(), ui_but_text_password_hide(), ui_but_update_ex(), ui_but_update_old_active_from_new(), ui_draw_menu_item(), ui_draw_preview_item(), ui_imageuser_slot_menu(), ui_node_menu_column(), ui_node_sock_name(), UI_panel_begin(), ui_panel_category_active_set(), UI_panel_category_add(), ui_pie_menu_level_create(), UI_popup_menu_reports(), UI_search_item_add(), ui_searchbox_apply(), ui_style_new(), ui_textedit_copypaste(), ui_textedit_string_set(), uiblock_layer_pass_buttons(), uiItemMenuEnumO_ptr(), uiItemMenuEnumR_prop(), uilist_filter_items_default(), uiStyleInit(), uiTemplateComponentMenu(), uiTemplateList(), uiTemplatePreview(), uiTemplateTextureUser(), undosys_id_ref_store(), blender::gpu::UniformBuf::UniformBuf(), unique_name(), unpack_all_invoke(), unpack_generate_paths(), updateDuplicateSubtarget(), uri_from_filename(), USD_export(), user_string_to_number(), vfont_init_data(), vgroup_duplicate(), vgroup_init_remap(), view_lock_to_active_exec(), visit_object(), weightvg_do_mask(), what_does_obaction(), where_am_i(), where_is_temp(), wm_drop_operator_options(), WM_dropboxmap_find(), WM_event_start_drag(), wm_file_write(), wm_homefile_read(), WM_init(), WM_jobs_get(), WM_keyconfig_new(), WM_keyconfig_remove(), WM_keyconfig_set_active(), WM_keymap_add_item(), WM_keymap_item_restore_to_default(), wm_keymap_new(), wm_lib_relocate_exec_do(), wm_link_append_data_item_add(), wm_link_append_data_library_add(), wm_link_append_exec(), wm_link_append_invoke(), wm_main_playanim_intern(), WM_modalkeymap_add_item_str(), wm_open_mainfile_description(), WM_operator_bl_idname(), wm_operator_create(), WM_operator_py_idname(), WM_operatortype_macro_define(), wm_revert_mainfile_exec(), wm_save_as_mainfile_exec(), workspace_layout_name_set(), blender::io::gpencil::GpencilExporterSVG::write(), write_crash_blend(), write_global(), and write_renderinfo().

◆ BLI_strncpy_ensure_pad()

char* BLI_strncpy_ensure_pad ( char *__restrict  dst,
const char *__restrict  src,
const char  pad,
size_t  maxncpy 
)

Like BLI_strncpy but ensures dst is always padded by given char, on both sides (unless src is empty).

Parameters
dstDestination for copy
srcSource string to copy
padthe char to use for padding
maxncpyMaximum number of characters to copy (generally the size of dst)
Return values
Returnsdst

Definition at line 132 of file string.c.

References BLI_assert, and BLI_strnlen().

Referenced by filelist_setfilter_options(), outliner_filter_tree(), and uilist_filter_items_default().

◆ BLI_strncpy_rlen()

size_t BLI_strncpy_rlen ( char *__restrict  dst,
const char *__restrict  src,
const size_t  maxncpy 
)

Like strncpy but ensures dst is always '\0' terminated.

Note
This is a duplicate of BLI_strncpy that returns bytes copied. And is a drop in replacement for 'snprintf(str, sizeof(str), "%s", arg);'
Parameters
dstDestination for copy
srcSource string to copy
maxncpyMaximum number of characters to copy (generally the size of dst)
Return values
Thenumber of bytes copied (The only difference from BLI_strncpy).

Definition at line 187 of file string.c.

References BLI_assert, and BLI_strnlen().

Referenced by applyEdgeSlide(), applyShrinkFatten(), applyVertSlide(), BKE_unit_name_to_alt(), BLI_path_extension_check_glob(), BLI_path_join(), BLI_path_rel(), ED_node_tree_path_get_fixedbuf(), get_stats_string(), get_thumb_dir(), IMB_thumb_load_font_get_hash(), nla_draw_strip_text(), scene_undo_depsgraph_gen_key(), ui_searchbox_region_draw_cb__operator(), uiTemplateImageInfo(), uiTemplateMovieclipInformation(), and unpack_generate_paths().

◆ BLI_strnlen()

size_t BLI_strnlen ( const char *  s,
const size_t  maxlen 
)

◆ BLI_vsnprintf()

size_t BLI_vsnprintf ( char *__restrict  buffer,
size_t  maxncpy,
const char *__restrict  format,
va_list  arg 
)

Portable replacement for vsnprintf.

Definition at line 211 of file string.c.

References BLI_assert, buffer, and NULL.

Referenced by BLI_snprintf().

◆ BLI_vsnprintf_rlen()

size_t BLI_vsnprintf_rlen ( char *__restrict  buffer,
size_t  maxncpy,
const char *__restrict  format,
va_list  arg 
)

A version of BLI_vsnprintf that returns strlen(buffer)

Definition at line 237 of file string.c.

References BLI_assert, buffer, and NULL.

Referenced by BLI_snprintf_rlen().

◆ left_number_strcmp()

static int left_number_strcmp ( const char *  s1,
const char *  s2,
int *  tiebreaker 
)
static

Definition at line 713 of file string.c.

Referenced by BLI_strcasecmp_natural().