Questions tagged [isalpha]
83 questions
0
votes
1 answer
Checking the return value of `isalpha`
#include
#include
#include
#include
#include
int main() {
char userPassword[20];
printf("Type in your password: \n");
scanf("%c", &userPassword);
if (isalpha(userPassword) == 0)…

sangmin park
- 547
- 3
- 7
- 16
0
votes
5 answers
C program for assigning elements of a matrix without letters
I'm having trouble outputting an invalid statement if the user inputs a letter instead of a number into a 2D array.
I tried using the isalpha function to check if the input is a number or a letter, but it gives me a segmentation fault. Not sure…

Kurly_Q
- 39
- 4
0
votes
2 answers
How to use an isalpha result to initiate an if statement?
Okay, so I have a for loop that checks through every letter of a string to make sure that the string is made entirely of alphabetical characters before moving on to the next stage of the program.
However, I am having trouble with my if statement…

Tom
- 21
- 1
- 1
0
votes
1 answer
How to check if an input is a valid name in python
I tried this code:
name = str(input("What is your name? "))
if not name.isalpha():
print("Please enter a valid name.")
continue
but when I enter a name with a space or full name, I get the "Please enter a valid name." statement even…

BjCuizon
- 11
- 1
- 2
0
votes
2 answers
Python : NoneType error in isalpha() function
I am currently stuck at problem with NoneType and using function isalpha() in Python. What I want to do is lexical analysis and I want to devide the whole code into four categories. Here is my code
import sys
import keyword …

Kuba Srna
- 15
- 1
- 5
-1
votes
2 answers
How to check if scanf input is a number? (user input has to be a float)
I´d like to check if user input is a float/integer or a letter. For this purpose the use of scanf() is important. My problem is that a letter is saved as zero but I can´t exclude it.
I tried building solving it with if and as a condition I tried…

S. Müller
- 3
- 5
-1
votes
2 answers
How do i have my ppinter point to the new string i created
void strip_out(char *str) {
int length_string = strlen(str);
//printf("%d\n", length_string);
char temp[length_string];
int i = 0;
int j = 0;
while ((*(str + i) != '\0')) {
if (isalpha(str[i])) {
…
-1
votes
1 answer
I want to be able to enter a word via an input, return true if the word contains english and false if it doesn't
I have written this code to ask for an input and then check if that word is english. If yes return true, if not return false.
def onlyEnglishLetters(word):
word = (input("Enter word here: "))
if word.isalpha():
return true
return…

james
- 11
- 4
-1
votes
2 answers
How to sort values of a dictionary based on the criteria imposed by values of a list in a new dictionary?
Apologies for the title, couldn't figure out a way to phrase this, if anyone has suggestions I'm happy to edit!
Basically, I have a dictionary and a list. The dictionary:
dict1 = {('red fruit', 'green fruit'): 'apple', ('orange fruit', 'pink…

Serena
- 75
- 7
-1
votes
1 answer
Is there an exception for ispunct() in C?
I want to write a code that will check the correctness of MAC address.
Input should look for example like this D7:6E:F4:30:17:2B.
Im thinking about using functions isdigit() and isupper(). Dont know how to make user avalaible to write " : " symbol…

jadamian
- 33
- 7
-1
votes
2 answers
Using tolower() and isalpha() to on a given string and set their output into another string
I want to pass a string to the compiler for example "Mr. Adam, I am Eve" . I want to lower the case of that phrase and remove all the punctuation marks and spaces by using (isalpha), i.e.- afterwards the string should be: mradamiameve which will be…

Cristhofer Lugo
- 23
- 3
-1
votes
1 answer
Checking if int is not alpha
I have a structure that has
int Hour
int Min
int Sec
I'm reading string from file. File has text like: 23:21:30 12:32:54
I split whole line to separate times and then I do second split to structure.
I'm doing
structure[x].Hour =…

Šarūnas Rakauskas
- 168
- 1
- 11
-1
votes
3 answers
.isalpha prints as False but when checked, is True
This is part of a function used to check that a password is 9 characters long, alphanumeric, and contains at least 1 number. Ideally I should be able to use the first if statement but strangely, it doesn't run. I can't figure out why test1.isalpha…
-2
votes
1 answer
How to check if a specific position in a string character or digit or not by using isdigit, isalpha
I wanna check a specific position in my string if it a character or not using isalpha the same by isdigit
I tried Using startswith and endswith but it didn’t work because I need to check only the start and the end of the string
-2
votes
1 answer
Am I using isalpha() function in c++ correctly?
I am working on a program that has a registry system where you can register new members.
To give some context, the name you register has to be different than existing names, can only be one word, and is turned into all caps before being saved to a…

wawa
- 127
- 5