C and C++ Programming Resources | C & C++ Code Example Index | C++ Code Example Index

 

 

 

 

The C Characters and Strings Manipulation Sample Codes Index Page

 

The following links provide sample C codes that related to the characters and strings manipulation. Those examples are making use the functions that available in the standard C library

 

 

    C Characters & Strings (The C character & string code samples which are the C functions used in manipulating characters & strings. This should include the secure or safe versions)

     

    1. Finding the last occurrence of a character in a string using strchr() C function

    2. Using atof() converting a string to double value

    3. Using atoi() converting a string to an integer value

    4. Using atol() converting a string to long integer

    5. Using strtod() converting a string to double precision value

    6. Using strtoul() converting string to unsigned long

    7. Using gets()/gets_s(), putchar() and reverse() functions to read from standard stream and write character to standard output

    8. Using strcat()/strcat_s() and strncat()/strncat_s() to append/concatenate strings

    9. Using getchar() and puts() to read characters from standard input and write string to standard output

    10. Using scanf()/scanf_s() to read formatted data from the standard input stream and sprintf()/sprintf_s() to write formatted data to a string

    11. Reading a formatted data from a string using sscanf()/sscanf_s() C function

    12. Copy a string using strcpy() and copy characters of one string to another using strncpy()

    13. Comparing the given strings using strcmp() and comparing characters of two strings using strncmp() C functions

    14. Searching a character in the given string using strchr() C function

    15. Finding the first character in a string that does not belong to a set of characters using strspn() C function

    16. Returns the index of the first occurrence of a character in a string that belongs to a set of characters using strcspn()

    17. Searching the first character occurrence in the given string using the C strpbrk() function

    18. Finding the first occurrence of a substring in the given string using strstr() C function

    19. Finding a next token in a string using strtok() C function

    20. Copying a string/substring to another string variable using memcpy() C function code sample

    21. Moving/copying a substring to a different position in the given string using memmove() C function code example

    22. Comparing two given string using memcmp() C function code sample

    23. Finding a substring in a given string using memchr() C function program example

    24. Replacing a substring in a given string using memset() C function program example

    25. Printing the system error messages based on their respective constants using strerror()/strerror_s() C function

    26. Using the sprintf()/sprintf_s() C function for standard outputs

    27. The isspace(), iscntrl(), ispunct(), isprint() and isgraph() C functions usage

    28. The islower(), isupper(), tolower() and toupper() C functions usage

    29. The isdigit(), isalpha(), isalnum(), and isxdigit() C functions usage

C and C++ Programming Resources | C & C++ Code Example Index | C++ Code Example Index