473,729 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can i check the String letters?

How can i check the String letters?
i have a textbox and will filled with numbers.
i want to check if the number contain a '0' in font of the numbers,
e.g. '090',i would like to cut the 1st '0', that will change to '90'.
and i want to check whether it has a space there and return an error
message. e.g. '0 9 0', then it will return an error.

i really dont know how to do it? please give me some guidliance,
thanks.

Aug 15 '06 #1
2 1619
Hi,
i would like to cut the 1st '0'
You can try CString::TrimLe ft
e.g. CString str = _T ("090");
str = str.Trimeft (_T ('0'));
Note: it will not erase only the first '0', it will trim all leading '0's.
e.g. CString str = _T ("00090");
>i want to check whether it has a space there and return an error message. e.g. '0 9 0', then it will return an error
try CString::Find
e.g. CString str = _T ("0 9 0");
//trim leading '0'
str = str.Trimeft (_T ('0'));

//Search space
if( str.Find (_T (' ')) != -1 )
{
//found space, do what you want
}
Yours,
Michael

"NEMA" wrote:
How can i check the String letters?
i have a textbox and will filled with numbers.
i want to check if the number contain a '0' in font of the numbers,
e.g. '090',i would like to cut the 1st '0', that will change to '90'.
and i want to check whether it has a space there and return an error
message. e.g. '0 9 0', then it will return an error.

i really dont know how to do it? please give me some guidliance,
thanks.

Aug 15 '06 #2

"NEMA" <re*******@gmai l.comwrote in message
news:11******** *************@i 3g2000cwc.googl egroups.com...
How can i check the String letters?
i have a textbox and will filled with numbers.
i want to check if the number contain a '0' in font of the numbers,
e.g. '090',i would like to cut the 1st '0', that will change to '90'.
and i want to check whether it has a space there and return an error
message. e.g. '0 9 0', then it will return an error.
Sounds like you want to normalize a integer's string representation. Try
using Integer.TryPars e to find out if it's a valid number (will catch spaces
or any other non-digit characters), and then ToString on the result to
format it the way you like, with/without leading zeros, etc.
>
i really dont know how to do it? please give me some guidliance,
thanks.

Aug 23 '06 #3

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

Similar topics

1
5714
by: ratlhead | last post by:
Hey all, I've provided a form for a client of the company I work for that basically emails the form data to an email address. Only a couple of the many fields are required...nothing too fancy. However, the sys admin has made the following request: "All fields, not just the required fields, need validation for syntax, shell escape characters and string length. This is a security issue."
2
2804
by: Edward K. Ream | last post by:
From the documentation for the string module at: C:\Python23\Doc\Python-Docs-2.3.1\lib\module-string.html letters: The concatenation of the strings lowercase and uppercase described below. The specific value is locale-dependent, and will be updated when locale.setlocale() is called.
21
23163
by: Andreas Lobinger | last post by:
Aloha, i wanted to ask another problem, but as i started to build an example... How to generate (memory and time)-efficient a string containing random characters? I have never worked with generators, so my solution at the moment is: import string import random random.seed(14)
11
3004
by: James Stroud | last post by:
Hello, I am looking for a nice way to take only those charachters from a string that are in another string and make a new string: >>> astr = "Bob Carol Ted Alice" >>> letters = "adB" >>> some_func(astr,letters) "Bad"
3
2699
by: Raed Sawalha | last post by:
I have the following letters; string letters = "a;b;c....to z"; the I need to replace the incoming string which containing letters above with integer 1 i did following for(int u=0;u<letters.Split(';').Length;u++) { FilesName = FilesName.Trim().Replace(letters.Split(';'), "1"); }
3
3935
by: Amy | last post by:
Hi, I have 6 If Then Else statements I was supposed to write. I did so but I know that they have to be wrong because they all look the same. Could someone take a look at them and point me in the right direction about what I am not doing correctly? 1.. Write an If Then Else statement that displays the string "Pontiac" in the CarMakeLabel control if the CarTextBox control contains the string "Grand Am" (in any case).
3
1629
by: sadhana | last post by:
Given a sequence of uppercase letters, we want to remove all but one occurrence of each letter, doing it in such a way that the remaining letters are in alphabetical order. Of course, there may be no way to do this, but if there is, we want to know which letters to remove. Create a class MakeUnique that contains a method eliminated that is given a String original, and returns original with the eliminated letters replaced with periods ('.')....
0
2075
by: clintp | last post by:
I've seen a few people asking for this elsewhere, so here's a basic implementation of a string trie in C#. I'm using this to load and search a dictionary of about two hundred thousand words. It's fairly quick (a couple of seconds for the full load). It's a bit of a memory hog -- about 50MB resident, once the file is loaded -- but most of my C#/.NET programs are. Example usage: StringTrie st = new StringTrie();
5
5995
by: ashurack | last post by:
I found a stored procedure online a while back and want to inplement it. The only problem is that it doesn't check to see if the number generated is currently in use in the DB. I know it's really unlikely for the same number to be generated twice (with a 10 digit number) but it's for a shopping cart so I need it to be 100% reliable. I thought about opening a cursor then looping through each distinct record in the DB but couldn't figure...
0
8917
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
8761
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
9426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9281
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...
0
9142
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
6022
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
4525
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
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
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

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.