C Workshop
PrintStats.c File Reference
#include <stdio.h>
#include <stdbool.h>
#include "PrintStats.h"

Functions

void PrintStats (int argc, char *argv[])
 Prints statistics about command line arguments: More...
 
bool IsSwitch (const char *arg)
 Check if the current parameter is a switch. More...
 
bool StringInRange (const char *arg, char start, char end)
 Checks if a string is contained in a specifed range. More...
 
bool IsUpperCase (const char *arg)
 Check if the current parameter is an uppercase parameter. More...
 
bool IsLowerCase (const char *arg)
 Check if the current parameter is a lowercase parameter. More...
 

Function Documentation

◆ IsLowerCase()

bool IsLowerCase ( const char *  arg)

Check if the current parameter is a lowercase parameter.

Parameters
argThe current parameter.
Returns
true if the current parameter is a lowercase parameter, false otherwise.

◆ IsSwitch()

bool IsSwitch ( const char *  arg)

Check if the current parameter is a switch.

Parameters
argThe current parameter.
Returns
true if the current parameter is a switch, false otherwise.

◆ IsUpperCase()

bool IsUpperCase ( const char *  arg)

Check if the current parameter is an uppercase parameter.

Parameters
argThe current parameter.
Returns
true if the current parameter is an uppercase parameter, false otherwise.

◆ PrintStats()

void PrintStats ( int  argc,
char *  argv[] 
)

Prints statistics about command line arguments:

  • A list of all the parameters.
  • The number of parameters.
  • How many switches
  • How many of the parameters are upper-case (the whole parameter), lower-case, and none of the above.
Parameters
argcNumber of command line arguments.
argvCommand line arguments.

◆ StringInRange()

bool StringInRange ( const char *  arg,
char  start,
char  end 
)

Checks if a string is contained in a specifed range.

Parameters
argThe string to check.
startLower bound of the range.
endUpper bound of the range.
Returns
true if the string is contained in the range, false otherwise.