Questions tagged [isalpha]
83 questions
1
vote
1 answer
Deleting isalpha out of function, causes it to return 0 all the time
I have to write a function to check for palindromes in sentences and words.
For sentences it looks like this (and works):
int checkSentencepalindrome(char * str)
{
size_t len = strlen(str);
char *pntr1 = str;
char *pntr2 = str + len…

wolffsen
- 11
- 3
1
vote
2 answers
Decide if string is a palindrome using 3 functions
I'm supposed to make a code that determines if entered string is a palindrome, the code is supposed to have 3 functions. The first is to determine if string is palindrome, the second is to use isalpha() to remove all non letters and the third is to…

dundern
- 37
- 3
1
vote
2 answers
Count the number of letters, digits and special characters in C program
So here is my code and I am struggling with the ispunct(); it starts counting in 8 and in isalpha() it starts counting in 1 so I print it noAlpha-1, but in ispunct() it is awkward to put noSpecial-8 to become accurate. I don't have any issues in…

singkit
- 11
- 1
1
vote
1 answer
What is time complexity of "isalnum(char)" in c++?
isalnum(char) is a method which tells us, whether a given character is alphanumeric or not.
What is the time complexity of this small function?
I have written a small subroutine :
bool check(string s,int i)
{
if((s[i]>='a' && s[i]<='z')…

Ankit
- 13
- 2
1
vote
0 answers
Check special character in string array using isalpha
So I am trying to take words from a file and save them into a dynamic array, and then print the array sorted alphabetically along with the concordance of each word in the array. I am facing a problem in identifying special characters/ numbers and…

AbuDavid
- 35
- 2
1
vote
2 answers
How to convert a string into individual letters char in c
I'm trying to run an isalpha check on an entered string but the issue is, that isalpha works only for individual characters apparently. If I run it like this on a string, I get a segmentation fault.
There might be a more elegant solution, but I can…

Joesns
- 45
- 5
1
vote
4 answers
How do I check if there is a special character in a string in C++ using isalpha?
Pretty new to coding here. We are working with the isalpha function and I am having trouble using it with a string. My program will prompt the user for a word and then the function will check if the word contains any special characters. Basically,…

time_in_real_time
- 33
- 7
1
vote
1 answer
How to convert UTF-8 text from file to some container which can be iterable and check every symbol for being alphanumeric in C++?
I read around 20 questions and checked documentation about it with no success, I don't have any experience writing code handling this stuff, I always avoided it.
Let's say I have a file which I am sure always will be UTF-8:
á
Let's say I have…

Lukas Salich
- 959
- 2
- 12
- 30
1
vote
2 answers
Simple Dictionary
The question asks to write a function creating a dictionary with the count of each word in the string and only remove the punctuation if it is the last character in the word. I've been trying to solve the punctuation part of the problem. For the…

Anfieldisonfire
- 11
- 3
1
vote
2 answers
How to check int or char in c
I have a code where I convert celsius to fahrenheit. And I need to check what user writes char or int.
I've tried isalpha and isdigit, but they do not work.
#include
#include
#include
int main()
{
char t[] = "";
…

I-Rey
- 63
- 1
- 1
- 6
1
vote
2 answers
How to get 'isalpha' to iterate through each character of string?
I am having trouble figuring out how to check each character in the keyword (argv[1]). I know I am probably missing something super obvious. :(
I have tried saving the string to an array, declaring a new int, but still same problem.
//check to make…

alexas
- 11
- 4
1
vote
3 answers
isalpha causing a "Debug Assertion Failed" in c++
I have a short program designed to count the number of consonants in a string by first testing to see if the character in the array is an alpha character (to skip any white space or punctuation). I keep getting a Debug Assertion Failed for my "if…

James Beaudry
- 13
- 2
1
vote
5 answers
Check if a string has only numbers in C?
I'm trying to write a simple code to check if a string only has numbers in it. So far it's not working, any help would be appreciated.
#include
#include
#include
int main()
{
char numbers[10];
int i,…

SycoSins
- 39
- 1
- 2
- 8
0
votes
1 answer
Python - How to stop a number being added to my list - isalpha()
I am making a hangman game and I'm mostly finished. I'm trying to cover some common errors to prevent players from doing silly things like...
Numbers are invalid. I have added str.isalpha(): below my input, and it correctly displays the message to…

Zursen
- 1
0
votes
3 answers
Find And Replace Character In Python
For the get_letter_from_user function, while using the while loop for validation, it keeps repeating the invalid input; I want to make sure that it is a single letter and lower case, and I want to make sure that it doesn't equal the second parameter…

Fran_CS
- 23
- 6