Character Handling Library Functions Overview

Download Presenatation
Character Handling Library Functions Overview
Slide Note
Embed
Share

This document provides an overview of the functions available in the character handling library, specifically focusing on useful tests and manipulations of character data. The functions discussed cover different operations such as checking if a character is a digit, letter, hexadecimal digit, lowercase letter, uppercase letter, whitespace character, control character, printing character, and more. Examples and descriptions are provided for each function, offering a comprehensive understanding of how to work with character data efficiently in programming.

  • Character handling
  • Library functions
  • Data manipulation
  • Programming
  • Character tests

Uploaded on Mar 10, 2025 | 18 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. 8.3 Character Handling Library Character handling library Includes functions to perform useful tests and manipulations of character data Each function receives a character (an int) or EOF as an argument The following slides contain a table of all the functions in <ctype.h> 1

  2. Prototype Function description Returns a true value if c is a digit and 0 (false) otherwise. int int isdigit( isdigit( int int c ); c ); Returns a true value if c is a letter and 0 otherwise. Returns a true value if c is a digit or a letter and 0 otherwise. c ); Returns a true value if c is a hexadecimal digit character and 0 otherwise. (See Appendix E, Number Systems, for a detailed explanation of binary numbers, octal numbers, decimal numbers and hexadecimal numbers.) Returns a true value if c is a lowercase letter and 0 otherwise. int int isalpha( isalpha( int int c ); c ); int int isalnum( isalnum( int int c ); c ); int int isxdigit( isxdigit( int int c ); int int islower( islower( int int c ); c ); Returns a true value if c is an uppercase letter and 0 otherwise. int int isupper( isupper( int int c ); c ); If c is an uppercase letter, tolower returns c as a lowercase letter. Otherwise, tolower returns the argument unchanged. int int tolower( tolower( int int c ); c ); Fig. 8.1| Character-handling library functions. (Part 1 of 2.) 2

  3. Prototype Function description If c is a lowercase letter, toupper returns c as an uppercase letter. Otherwise, toupper returns the argument unchanged. Returns a true value ifc is a white-space character newline ('\n'), space (' '), form feed ('\f'), carriage return ('\r'), horizontal tab ('\t') or vertical tab ('\v') and 0 otherwise. Returns a true value ifcis a control character and 0 otherwise. int int toupper( toupper( int int c ); c ); int int isspace( isspace( int int c ); c ); int int iscntrl( iscntrl( int int c ); c ); Returns a true value if c is a printing character other than a space, a digit, or a letter and returns 0 otherwise. Returns a true value if c is a printing character including a space (' ') and returns 0 otherwise. Returns a true value ifcis a printing character other than a space (' ') and returns 0 otherwise. int int ispunct( ispunct( int int c ); c ); int int isprint( isprint( int int c ); c ); int int isgraph( isgraph( int int c ); c ); Fig. 8.1| Character-handling library functions. (Part 2 of 2.) 3

  4. Error-Prevention Tip 8.2 When using functions from the character- handling library, include the <ctype.h> header. 4

  5. 5

  6. 6

  7. 7

  8. 8

  9. 9

Related


More Related Content