#include<string.h> contains the function description

Publisher:LovingLife2023Latest update time:2022-04-20 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Common functions: 

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

Function name strcpy

Function copies one string to another

Original function char *strcpy(char *destin, char *source);

Example

char str[10];


char *str1="abcde";


strcpy(str,str1);


str contains "abcde"


This copies str1 to str


Function name strncpy

The function copies up to n characters in the string src to the character array dest (it does not stop copying when it encounters NULL like strcpy, but waits until n characters are collected before starting copying), and returns a pointer to dest. Note that it will overwrite previous characters.

Original function char *strncpy(char *dest, char *src,n);

Example

str[10]="abcdef",str1[10]="12345";


strncpy(str,str1,3); then str contains "123def"


Function name strcat

Function string concatenation function

Usage: char *strcat(char *destin, char *source);

Example

str[10]="abcdef",str1[10]="12345";


strcat(str,str1); then str contains "abcde12345"


Function name strcmp

Function string comparison

usage

intstrcmp(char *str1, char *str2);


If two strings are equal, return 0;


Example  

Function name strlen

Function strlen function finds the length of a string. It counts from the beginning of the string until it encounters the first ''. If you only define it without assigning an initial value, the result is uncertain. It will count from the beginning of the string until it encounters a ''.

usage  

Example  

Function name strnicmp

This function compares a part of a string to another string, regardless of case. 

Usage: strnicmp(char *str1, char *str2, unsigned maxlen);

For example, strnicmp(str1,str2,3) compares the first three characters of the latter string with the former string. If the characters are greater than the former, -1 is returned; if the characters are less than the former, 1 is returned; if the characters are equal, 0 is returned.

Function name stricmp

Function to compare two strings in a case-insensitive manner (don't understand)

Usage: int stricmp(char *str1, char *str2);

Example  

Function name strcmpi

This function compares one string to another, regardless of case.

Usage: int strcmpi(char *str1, char *str2);

Example  

Function name strrev

Function string reversal

Usage: char *strrev(char *str);

Example  

Function name strtod

Function to convert a string into a double value

Usage: double strtod(char *str, char **endptr);

Description Convert the initial string of numbers into double type

Example

char input[90],*end;


gets(input);


double value=strtod(intput,&end);


Function name strtol

Function to convert a string to a long integer

Usage: longstrtol(char *str, char **endptr, int base);

Example  

Function name

strupr


Function to convert lowercase letters in a string to uppercase letters

Usage: char *strupr(char *str);

Example  

Function name strchr

This function finds the first occurrence of a given character in a string.

Usage: char *strchr(char *str, char c);

Example  

Function name strcspn

This function finds the first segment with a given character set in a string.

Usage: int strcspn(char *str1, char *str2);

Example  

Function name strdup

The function copies the string to the newly created location

Usage: char *strdup(char *str);

Example  

Function name strerror

The function returns a pointer to an error message string.

Usage: char *strerror(int errnum);

Example  

Function name strnset

This function sets all characters in a string to the specified characters.

Usage: char *strnset(char *str, char ch, unsigned n);

Example  

Function name strpbrk

This function searches for characters in a given character set in a string.

Usage: char *strpbrk(char *str1, char *str2);

Example  

Function name strrchr

This function finds the last occurrence of a specified character in a string.

Usage: char *strrchr(char *str, char c);

Example  

Function name strstr

This function finds the first occurrence of a specified string in a string.

Usage: char *strstr(char *str1, char *str2);

Example  

Function name strtok

This function searches for words separated by the delimiter specified in the second string.

Usage: char *strtok(char *str1, char *str2);

Example  

Function name swab

Function swap byte

Usage: void swab (char *from, char *to, int nbytes);

Example  


Reference address:#include<string.h> contains the function description

Previous article:#include<ctype.h> contains the function description
Next article:#include<stdlib.h> contains the function description

Recommended ReadingLatest update time:2024-11-17 14:54

Design method of missile decoupling controller based on H∞ mixed sensitivity
1 Introduction When a missile flies at a high angle of attack, there is serious aerodynamic coupling between channels. In engineering design, smaller coupling terms are usually treated as random interference. However, when the coupling effect is large, the control system will easily lose stability. Therefore, th
[Industrial Control]
Design method of missile decoupling controller based on H∞ mixed sensitivity
H-bridge bidirectional DC motor drive circuit
The chip mainly includes logic circuit, voltage detection circuit, rectifier, charge pump, power MOSFET. In addition, there are protection circuits to prevent electrostatic discharge (ESD), overvoltage protection, overcurrent protection, load open circuit and short circuit protection circuits, protection circuits fo
[Analog Electronics]
H-bridge bidirectional DC motor drive circuit
Use of C51 header file INTRINS.H
The INTRINS.H function will make it as easy for you to use as in assembler. Internal function description _crol_ Characters rotate left _cror_ Characters rotate right _irol_ Integer circular left shift _iror_ Integer rotate right _lrol_ Circular left shift of long integer _lror_ long integer circular right
[Microcontroller]
Storage business booms, Goke Microelectronics' H1 revenue up 393%
Gokewei released its semi-annual performance report on the evening of August 27, saying that its operating income in the first half of 2021 was about 952 million yuan, a year-on-year increase of 393.08%; the loss attributable to shareholders of the listed company was about 10.23 million yuan; the basic loss per share
[Mobile phone portable]
Storage business booms, Goke Microelectronics' H1 revenue up 393%
AVR Notes 5: .c and .h Nature
       .c and .h are both text files, and I also use .r to indicate a private .h. If you like, you can use any text format. I agree with your point of view. As for the difference, I think there is still a little difference. For example, for ICC, under project compilation, the compiler can only see the .c file, while th
[Microcontroller]
Customize the reg52.h header file (key knowledge points of microcontroller learning)
/*-------------------------------------------------------------------------- Custom REG52 header file @auth lei @date 2017-05 --------------------------------------------------------------------------*/ #ifndef __REG52_H__ #define __REG52_H__ /* One byte register */
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号