Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This checks if the char is either a number or a letter
- int checkIfChar(char c) {
- if (c >= 'A' && c <= 'Z') {
- return 1;
- }
- if (c >= 'a' && c <= 'z') {
- return 1;
- }
- if (c >= '0' && c <= '9') {
- return 1;
- }
- return 0;
- }
- // This handles the processing of the plus case
- int plusCase(char *partial_line, char *pattern) {
- int count = 0;
- // Loop while we have another pattern instance
- while(*partial_line == *(pattern-1)) {
- partial_line++;
- count++;
- }
- return count;
- }
- // This handles the processing of the question mark case
- int questionMarkCase(char *partial_line, char *pattern) {
- // This checks if we still
- if(*(partial_line) == *(pattern)) {
- return 1;
- }
- else {
- return 2;
- }
- return 0; // No question mark
- }
- // This handles the processing of the backslash case
- int backslashCase(char *partial_line, char *pattern) {
- // skips whatever we are escaping
- if(*(partial_line) == *(pattern+1)) {
- return 1;
- }
- return 0; // no backslash
- }
- // This handles the processing of the fullstop case
- int fullStopCase(char *partial_line, char *pattern) {
- int checker = 0;
- // checks if it is actually a char se we can skip over it
- checker = checkIfChar(*partial_line);
- if(checker){
- return 1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement