Operation of C + + string (simple and comprehensive)

Source: Internet
Author: User

void *memccpy (void *dest, const void *SRC, int c, size_t N);

Copies n characters from the object pointed to by SRC to the object pointed to by Dest. If a character C is encountered during the copy process, the copy is stopped, the pointer points to the next position of character C in dest, otherwise null is returned.

void *memcpy (void *dest, const void *SRC, size_t n);

Copies n characters from the object pointed to by SRC to the object pointed to by Dest. Returns the value of the pointer to Dest.

void *memchr (const void *s, int c, size_t N);

Searches for the character C in the first n characters of the object pointed to by S. If a search is found, the return pointer points to the position where the character C first appears; otherwise returns null.

int memcmp (const void *S1, const void *S2, size_t n);

Compares the first n characters of the object that S1 points to and the object that S2 points to. The return value is the first distinct character difference between S1 and S2.

int memicmp (const void *S1, const void *S2, size_t n);

Compares the first n characters of the object that S1 points to and the object that S2 points to, ignoring the case. The return value is the first distinct character difference between S1 and S2.

void *memmove (void *dest, const void *SRC, size_t n);

Copies n characters from the object pointed to by SRC to the object pointed to by Dest. Returns the value of the pointer to Dest. Memory overlap does not occur.

void *memset (void *s, int c, size_t N);

Sets the first n characters of the object pointed to by S as character C. Returns the value of S for the pointer.

Char *stpcpy (char *dest, const char *SRC);

Copy the string src to dest. Returns the value of Dest + len (SRC) pointer.

Char *strcpy (char *dest, const char *SRC);

Copy the string src to dest. Returns the value of the pointer to Dest.

Char *strcat (char *dest, const char *SRC);

Adds a string src to the dest trailer. Returns the value of the pointer to Dest.

Char *strchr (const char *s, int c);

Searches for the character C in the string S. If a search is found, the return pointer points to the position where the character C first appears; otherwise returns null.

int strcmp (const char *S1, const char *S2);

Compares string s1 and string s2. The return value is the first distinct character difference between S1 and S2.

int stricmp (const char *S1, const char *S2);

Compares string S1 and string s2, ignoring case. The return value is the first distinct character difference between S1 and S2.

size_t strcspn (const char *S1, const char *S2);

The return value is the initial string length consisting entirely of characters that are not contained in the string S2, S1.

size_t strspn (const char *S1, const char *S2);

The return value is the initial string length consisting entirely of the characters contained in the String S2, which is the S1 of the strings.

Char *strdup (const char *s);

Gets the copy of a string s. The return pointer points to the first address of the copied string.

char *strerror (int errnum);

The return pointer points to the first address of the error message string that is associated by Errnum. See errno.h for Errnum macro definitions.

size_t strlen (const char *s);

The return value is the length of the string s. Does not include the Terminator ' + '.

Char *strlwr (char *s);

Converts the string s all to lowercase. Returns the value of S for the pointer.

Char *strupr (char *s);

Converts the string s all to uppercase. Returns the value of S for the pointer.

Char *strncat (char *dest, const char *SRC, size_t maxlen);

Adds a string src to the dest tail, adding up to maxlen characters. Returns the value of the pointer to Dest.

int strncmp (const char *S1, const char *S2, size_t maxlen);

Compares the string S1 to the string s2, with a maximum of maxlen characters. The return value is the first distinct character difference between S1 and S2.

Char *strncpy (char *dest, const char *SRC, size_t maxlen);

Copy the string src to dest, copying up to maxlen characters. Returns the value of the pointer to Dest.

int strnicmp (const char *S1, const char *S2, size_t maxlen);

Compares string S1 to string s2, ignores case, and compares up to maxlen characters. The return value is a different character difference from S1 to S2.

Char *strnset (char *s, int ch, size_t n);

Sets the first n characters in the string s embox to the character C. Returns the value of S for the pointer.

Char *strset (char *s, int ch);

Sets the character Embox in the string s to C. Returns the value of S for the pointer.

Char *strpbrk (const char *S1, const char *S2);

Returns a pointer to the position of the first occurrence of any character of the string S2 in the string S1, or null if it does not appear.

Char *strrchr (const char *s, int c);

Searches for the character C in the string S. If a search is reached, the return pointer points to the last occurrence of the character C, otherwise null is returned.

Char *strrev (char *s);

Flips all the strings, returning the pointer to the flipped string.

Char *strstr (const char *S1, const char *S2);

Searches the string s1 for the string S2. If a search is reached, the return pointer points to the position where the string S2 first appears; otherwise null is returned.

Char *strtok (char *s1, const char *S2);

S1 the string by separating it with the characters in the String S2. The return pointer points to the split string. The first call requires nulll instead of S1 as the first parameter.

Operation of C + + string (simple and comprehensive)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.