473,569 Members | 2,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

String cleansing

Given a short string that should only contain an (integer) number, is there
a way to filter out anything that is not a number?
Many thanks.
Patrick.

Nov 16 '05 #1
2 1843
use the following method

private static Regex _isNumber = new Regex(@"^\d+$")

public static bool IsInteger(strin g theValue

Match m = _isNumber.Match (theValue)
return m.Success
} //IsInteg

Regards
AMAL
Nov 16 '05 #2
"Patrick de Ridder" <wa********@all .here> wrote in message news:<10******* ********@news-01.evisp.enerte l.nl>...
Given a short string that should only contain an (integer) number, is there
a way to filter out anything that is not a number?
Many thanks.
Patrick.


Hi,
A Tip. Try using regular expressions.
Nov 16 '05 #3

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

Similar topics

5
3819
by: Andy | last post by:
Does anyone know of a deduplication and data cleansing tool that works with Access databases? Thanks Andy
8
5020
by: moondaddy | last post by:
I'm writing an app in vb.net 1.1 and I need to parse strings that look similar to the one below. All 5 rows will make up one string. I have a form where a use can copy/paste data like what you see below from excel, word, notepad, etc.. into a textbox on my form. I need to break each line into 2 numbers which I'll use as parameters for...
7
52447
by: kangaroo | last post by:
Hello, I have a column of type VARCHAR, storing some generally character data. A few of the values in that column are in fact numbers represented as strings (e.g., "12345"). At some moment I need to select those numbers, cast them to INT and do some math on them. Naturally, I do something like this: SELECT INT(MYCOLUMN) WHERE...
5
13963
by: midhunmathe | last post by:
Hello, I get an error #', hexadecimal value 0x07, is an invalid character. Line 2, position 6358. on the XMLTextReader.Read() call on a particular node of my XML document. I need this data to be parsed. This is a cyrillic character data and my comp has a latin code page 1252. Is XML parsing dependant on these values? If yes, is there any...
11
2003
by: bcurtu | last post by:
Hi, I have a BIIIIIG problem with the next query: cursor.execute(""" SELECT titem.object_id, titem.tag_id FROM tagging_taggeditem titem WHERE titem.object_id IN (%s) """,( eid_list))
0
7694
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...
0
7609
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...
0
7921
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. ...
1
7666
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...
0
7964
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...
1
5504
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...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2107
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
0
936
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...

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.