473,738 Members | 2,009 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
12 1653
I should have given you one more line of code

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 (isspace(*szTmp Str2)) szTmpStr2++; //Error 1 error C2105: '++' needs
l-value

if( !isalpha(szTmpS tr2[0]))


"Brian Muth" <bm***@mvps.org wrote in message
news:ec******** ********@TK2MSF TNGP02.phx.gbl. ..
>
" 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_GetTe xt(GetDlgItem( hDlg, IDC_N_USERNAME) , szTmpStr,
SIZE_OF_USER_N AME);

strcpy_s(szTmp Str2,72,szTmpSt r);

strcat_s(szTmp Str2,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 #11
In article <eH************ **@TK2MSFTNGP02 .phx.gbl>,
Frank <fr***@a-znet.comwrote:
>strcpy_s(szTmp Str2,72,szTmpSt r);
strcat_s(szTmp Str2,72, "5"); //Make sure the strip code that follows leaves
something
while (isspace(*szTmp Str2)) szTmpStr2++; //Error 1 error C2105: '++' needs
l-value
Make a pointer, then ++ it. For example:

char* pStart = &szTempStr2[0];
while(isSpace(* pStart)) ++pStart;

At the end, pStart is a pointer to some memory (WITHIN szTempStr2)
that has the string minus any leading spaces. Copy that off to another
buffer if you want.

Nathan Mates
--
<*Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A. Heinlein
Jan 31 '07 #12
Thanks
"Nathan Mates" <na****@visi.co mwrote in message
news:12******** *****@corp.supe rnews.com...
In article <eH************ **@TK2MSFTNGP02 .phx.gbl>,
Frank <fr***@a-znet.comwrote:
>>strcpy_s(szTm pStr2,72,szTmpS tr);
strcat_s(szTm pStr2,72, "5"); //Make sure the strip code that follows
leaves
something
while (isspace(*szTmp Str2)) szTmpStr2++; //Error 1 error C2105: '++' needs
l-value

Make a pointer, then ++ it. For example:

char* pStart = &szTempStr2[0];
while(isSpace(* pStart)) ++pStart;

At the end, pStart is a pointer to some memory (WITHIN szTempStr2)
that has the string minus any leading spaces. Copy that off to another
buffer if you want.

Nathan Mates
--
<*Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A.
Heinlein

Jan 31 '07 #13

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

Similar topics

12
1952
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
4818
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
6167
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
6029
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
9173
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
11009
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
9488
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
7987
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
1787
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
8787
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,...
1
9259
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
9208
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...
1
6750
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6053
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();...
0
4569
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4824
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
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.