Apache C++ Standard Library Reference Guide

## isalnum()

Library: Localization

    Function

- Local Index
- Summary
- Synopsis
- Description
- Example
- See Also
- Standards Conformance

### Local Index

No Entries

### Summary

Locale convenience function that determines if a character is alphabetic or numeric

### Synopsis

    #include <locale>

    namespace std {
      template <class charT>
      bool isalnum(charT c, const locale& loc);
    }

### Description

The `isalnum()` function returns `true` if the character passed as a parameter is either part of the alphabet specified by the `locale` parameter or a decimal digit. Otherwise the function returns `false`. The check is made using the `ctype` facet from the `locale` parameter.

### Example

    //
    //  isalnum.cpp
    //

    #include <iostream>   // for cout, endl
    #include <locale>     // for isalnum

    int main ()
    {
        std::cout << "Alphanumeric ASCII characters: ";

        // iterate
        for (char c = '\0'; c != '\177'; ++c)
            if (std::isalnum (c, std::cout.getloc ()))
                std::cout << c << ' ';

        std::cout << std::endl;

        return 0;
    }

    Program Output:

    Alphanumeric ASCII characters: 0 1 2 3 4 5 6 7 8 9 A B C D E F G
    H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m
    n o p q r s t u v w x y z

### See Also

ctype, locale, `isalpha()`, `iscntrl()`, `isdigit()`, `isgraph()`, `islower()`, `isprint()`, `ispunct()`, `isspace()`, `isupper()`, `isxdigit()`

### Standards Conformance

ISO/IEC 14882:1998 -- International Standard for Information Systems -- Programming Language C++, Section 22.1.3.1