C String String Function

C examples for String:String Function

Description

Click the following links for the tutorial for String and String Function.

  1. Strstr() function takes two strings as arguments and searches the first string for an occurrence of the second string.
  2. Strcmp() function compares two strings for equality.
  3. Strcat() function concatenates or glues one string to another.
  4. Strcpy() function copies the contents of one string into another string.
  5. Converting Strings To Numbers
  6. Create your own version of tolower() and toupper()
  7. Use string conversion functions and then do math calculation
  8. Assign string value with strcpy


  9. Read input and append them together
  10. compares character strings str1 and str2, and returns negative, zero, or positive if str1 is lexicographically less than, equal to, or greater than str2, respectively
  11. copies string source to string target, pointer based 2
  12. copies string source to string target, pointer based
  13. copies string source to string target. This is pointer based version:
  14. copies string source to string target. This is an array subscript based version:
  15. computes the length of string str, pointer based
  16. converts a string of digits into a double type number.


  17. returns index of string s2 in string s1 and returns -1 if no substring s2 is found in s1.
  18. removes trailing blanks, tabs, and newlines from string str:
  19. converts an integer into a string of digits:
  20. reverses the contents of string str. You are required to #include the header file <string.h>.
  21. reverses the contents of string str.
  22. concatenates string str2 to end of string str1; string str1 must be big enough so as to accommodate the string str2:
  23. converts a string of digits str into an equivalent integer:
  24. returns a length of the string str:
  25. copies char array source to char array target:
  26. Use functions toupper() and tolower() to convert character case
  27. Change character case with functions strlwr() and strupr().
  28. Searching string with strstr().
  29. Searching string with strspn()
  30. Using the strncpy() function to copy sub string
  31. Use strncmp() function to compare substring
  32. Use strncat() function to append two string together
  33. Using the strlen() function to get string length
  34. Demonstrates strrev(), strset(), and strnset().
  35. Use non-ANSI strdup() function.
  36. Searching string with strcspn().
  37. Use strcpy() to copy string
  38. Use strcmp() function to compare string
  39. Searching for a single character with strchr().
  40. Using strcat() function to copy string
  41. Demonstration of atof().
  42. Reverse string s in place with extra variable
  43. Reverse string s in place
  44. Search sub string
  45. Copy string by length, like strncmp
  46. Copy string by length, like strncpy
  47. Concatenate two string by length, like strncat
  48. Create function to check is a string is ending with another string
  49. Append two string together
  50. Create your own function to convert string to double
  51. Remove trailing blanks and tabs
  52. Convert string to integer
  53. Remove char from string
  54. Create your own function to convert string to integer
  55. Replaces tabs in the input with the blanks space
  56. Fold long input lines into two or more shorter lines after the last non-blank character
  57. Remove all comments from a C program and handle quoted strings and character constants
  58. Returns the first location in a string s1 where any character from the string s2 occurs, or -1 if s1 contains no characters from s2.
  59. Deletes each character in s1 that matches any character in the string s2.
  60. Create your own function to get the length of a string
  61. Expands shorthand notations like a-z into the equivalent complete list abc...xyz
  62. Create your own function to convert integer to string
  63. Create a function which returns the position of the rightmost occurrence of t in s, or -1 if there is none.
  64. Concatenate one string to another string
  65. Convert integer to characters in s
  66. Create your own version of strncpy(s1,s2,n) function
  67. Write your own version of strncpy(s1,s2,n) function
  68. Use sprintf() to combine three items into a string
  69. Strncpy() takes a third argument, which is the maximum number of characters to copy.
  70. Get the return from strcpy()
  71. Check first letter of string input
  72. Strcmp() function compares strings until it finds corresponding characters that differ,
  73. Use the strcmp() function for checking to see whether a program should stop reading input.
  74. Check strcmp function returns
  75. Compare string with your own function
  76. Joins two strings, check size first
  77. Joins two strings with strcat() function
  78. Strlen() finds the length of a string
  79. Use user-defined output functions
  80. Pass the address of a string to puts()
  81. Use gets_s() and puts() functions to read and output string
  82. Create a function for string-shrinking
  83. Removes the spaces from the string
  84. Replaces the contents of a string with the string reversed.
  85. Check if the second string is contained in the first string
  86. Check if a character is contained in a string
  87. Search string specified by the first parameter for the first occurrence of a character specified by the second parameter
  88. Find token with strrtok function
  89. Use the character classification functions to prepare an implementation of atoi()
  90. Print a letter x time per line in total y number of lines
  91. Create a function chline(ch,i,j) that prints the requested character in columns i through j.
  92. Report the number of uppercase letters, the number of lowercase letters, and the number of other characters in the input.