473,698 Members | 2,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is the first character in a string a letter?

There must be an easier way then what I'm doing to determine if the first
character in a string is a valid letter.

My code is getting to big. There must be a better way.

Thanks in advance
Jan 31 '07 #1
12 1650

" Frank" <fr***@a-znet.comwrote in message
news:OV******** ********@TK2MSF TNGP05.phx.gbl. ..
There must be an easier way then what I'm doing to determine if the first
character in a string is a valid letter.

My code is getting to big. There must be a better way.
Anything wrong with isalpha(s[0]) ?

Brian
Jan 31 '07 #2
The only thing wrong with it is that I couldn't find it

thanks

"Brian Muth" <bm***@mvps.org wrote in message
news:eN******** ******@TK2MSFTN GP05.phx.gbl...
>
" Frank" <fr***@a-znet.comwrote in message
news:OV******** ********@TK2MSF TNGP05.phx.gbl. ..
>There must be an easier way then what I'm doing to determine if the first
character in a string is a valid letter.

My code is getting to big. There must be a better way.

Anything wrong with isalpha(s[0]) ?

Brian

Jan 31 '07 #3
While I was at it I should have asked you about trimming a string of leading
white space.

Is there a easy way?

I've been searching the doc and the internet but can't find anything.

Thanks again
"Brian Muth" <bm***@mvps.org wrote in message
news:eN******** ******@TK2MSFTN GP05.phx.gbl...
>
" Frank" <fr***@a-znet.comwrote in message
news:OV******** ********@TK2MSF TNGP05.phx.gbl. ..
>There must be an easier way then what I'm doing to determine if the first
character in a string is a valid letter.

My code is getting to big. There must be a better way.

Anything wrong with isalpha(s[0]) ?

Brian

Jan 31 '07 #4
I found something to try
" Frank" <fr***@a-znet.comwrote in message
news:OX******** ******@TK2MSFTN GP04.phx.gbl...
While I was at it I should have asked you about trimming a string of
leading white space.

Is there a easy way?

I've been searching the doc and the internet but can't find anything.

Thanks again
"Brian Muth" <bm***@mvps.org wrote in message
news:eN******** ******@TK2MSFTN GP05.phx.gbl...
>>
" Frank" <fr***@a-znet.comwrote in message
news:OV******* *********@TK2MS FTNGP05.phx.gbl ...
>>There must be an easier way then what I'm doing to determine if the
first character in a string is a valid letter.

My code is getting to big. There must be a better way.

Anything wrong with isalpha(s[0]) ?

Brian


Jan 31 '07 #5
Frank wrote:
While I was at it I should have asked you about trimming a string of leading
white space.

Is there a easy way?

I've been searching the doc and the internet but can't find anything.
Frank:

If you are using CString then there is TrimLeft().

David Wilkinson
Jan 31 '07 #6
I'm doing plain C
Can you see what is wrong with the while statement
ComboBox_GetTex t(GetDlgItem( hDlg, IDC_N_USERNAME) , szTmpStr,
SIZE_OF_USER_NA ME);

strcpy_s(szTmpS tr2,72,szTmpStr );

strcat_s(szTmpS tr2,72, "5"); //Make sure the strip code that follows leaves
something

while (iswspace(*szTm pStr2)) szTmpStr2++; //Error 1 error C2105: '++' needs
l-value
if( !isalpha(szTmpS tr2[0])) //check the first character
Thanks for the reply
"David Wilkinson" <no******@effis ols.comwrote in message
news:ew******** ******@TK2MSFTN GP05.phx.gbl...
Frank wrote:
>While I was at it I should have asked you about trimming a string of
leading white space.

Is there a easy way?

I've been searching the doc and the internet but can't find anything.

Frank:

If you are using CString then there is TrimLeft().

David Wilkinson

Jan 31 '07 #7

" Frank" <fr***@a-znet.comwrote in message
news:OO******** ******@TK2MSFTN GP04.phx.gbl...
The only thing wrong with it is that I couldn't find it

thanks
Couldn't find it? Have you heard of Google by any chance?

http://msdn2.microsoft.com/en-us/lib...z8(VS.80).aspx

Brian
Jan 31 '07 #8

" Frank" <fr***@a-znet.comwrote in message
news:er******** *****@TK2MSFTNG P02.phx.gbl...
I'm doing plain C
Can you see what is wrong with the while statement
ComboBox_GetTex t(GetDlgItem( hDlg, IDC_N_USERNAME) , szTmpStr,
SIZE_OF_USER_NA ME);

strcpy_s(szTmpS tr2,72,szTmpStr );

strcat_s(szTmpS tr2,72, "5"); //Make sure the strip code that follows
leaves something

while (iswspace(*szTm pStr2)) szTmpStr2++; //Error 1 error C2105: '++'
needs l-value
char *p = szTmpStr2;
while (iswspace(*p)) p++;

Jan 31 '07 #9
I'm constantly on it
Knowing the correct thing to search for is the trick to not getting 10
million hits

"Brian Muth" <bm***@mvps.org wrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>
" Frank" <fr***@a-znet.comwrote in message
news:OO******** ******@TK2MSFTN GP04.phx.gbl...
>The only thing wrong with it is that I couldn't find it

thanks

Couldn't find it? Have you heard of Google by any chance?

http://msdn2.microsoft.com/en-us/lib...z8(VS.80).aspx

Brian

Jan 31 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
1949
by: frizzle | last post by:
Hi there! I have (for sofar) a small problem: I have a site, with mySQL-backend, and an online admin system. The site is in three languages: 1 of them is German. My poblem concerns the 'ß' (without quotes), and probably more characters.
3
4786
by: Nacho | last post by:
i need to convert the first letter of a veriable to uppercase (the veriable is loaded and the applied LCase() ) thanks -- Nacho
10
6161
by: Sergio del Amo | last post by:
Hi, I am trying to create a web site to work in Opera 7.2, Explorer 6.0 and Mozilla 1.4. I have the code: var imgs= document.getElementsByTagName("img"); alert(imgs.id); The id of imgs is a10. A window is open with Opera, Explorer and Mozilla with the text "a10". When i write:
12
6022
by: Alan J. Flavell | last post by:
OK, today's email brought a comment from a reader, pointing out something that I'd long since noticed myself but hadn't done anything about it. On my pages, I've got a first-letter style on paragraphs. So far, so good: some of the paragraphs begin with a link, and there are styles in the stylesheet for link, hover etc. The first letter is still displayed as styled for the paragraph's first-letter.
2
9170
by: coolvixs | last post by:
hi, i have some data in mysql in a column like this: 6.1.01 Financial Regulations 3.32.02 Academic Counseling what iam selecting is select by letter A, B, C...Z. so my first char in the column is always a integer, how can i select when the first few characters are always a integer, i want to get rid of the integers and run query on the word when selecting.
15
11006
by: wizardyhnr | last post by:
i want to try ANSI C99's unicode fuctions. so i write a test program. the function is simple, but i cannot compile it with dev c++ 4.9.9.2 under windows xp sp2, since the compiler always think that the initialization of the wchar_t string is illegal. here is my function: #include <stdio.h> #include <stdlib.h> #include <wchar.h> #include <wctype.h> #include <string.h>
44
9474
by: Kulgan | last post by:
Hi I am struggling to find definitive information on how IE 5.5, 6 and 7 handle character input (I am happy with the display of text). I have two main questions: 1. Does IE automaticall convert text input in HTML forms from the
9
7984
by: sovht | last post by:
System: Intel, Windows XP Pro, SP2 IDE: VC++ 6.0 Problem: *Very* simple program to create a MessageBox only ever displays the first character of the given string. I checked the spec for the MessageBox function and I believe I am adhering to it. I have also done a search for this issue, but have come up empty handed. Perhaps my search parameters were at fault ... #include <windows.h> // added to make MessageBox work (esp w/MB_<code>s)...
40
1776
by: Tameem | last post by:
hi my name is tameem. i am a new c programmer. in a c program i want to give input ""tameem"" and the output will be ""xdphhp"" in a short: the character ""a"" will be replaced by ""d"" i can convert only a character.so how can i convert a word or a sentence my character convert program is given below: #include<stdio.h>
0
8680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9030
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7738
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.