hey all,
given a string, if i only wanted to get only letters and number (no symbols)
is there a function to do this?
i.e.
"Los Angeles, CA"
i don't want the comma.
thanks,
rodchar 3 12116
"rodchar" <ro*****@discus sions.microsoft .com> wrote in message
news:7E******** *************** ***********@mic rosoft.com... given a string, if i only wanted to get only letters and number (no symbols) is there a function to do this? i.e. "Los Angeles, CA" i don't want the comma.
Function CleanInput(strI n As String) As String
' Replace invalid characters with empty strings.
Return Regex.Replace(s trIn, "[^\w\.@-]", "")
End Function
You can use
Return Regex.Replace(s trIn, ",", "")
if that's all you need.
The easy way:
Dim s as string = strIn.Replace(" ,", "")
or the relatively easy way:
Dim strOut as string = ""
for each c as char in strIn.ToCharArr ay()
if char.IsLetterOr Digit(c) then
strOut &= c.ToString()
end if
next.
Either way, YOU WIN!
SN
Hi,
Use a regular expression.
Dim regText As New System.Text.Reg ularExpressions .Regex("^[a-zA-Z0-9]+$ ")
Trace.WriteLine (regText.IsMatc h("Los Angeles, CA")) http://regexlib.com/Search.aspx?k=alphanumeric
Ken
---------------
"rodchar" <ro*****@discus sions.microsoft .com> wrote in message
news:7E******** *************** ***********@mic rosoft.com... hey all,
given a string, if i only wanted to get only letters and number (no symbols) is there a function to do this? i.e. "Los Angeles, CA" i don't want the comma.
thanks, rodchar This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sugapablo |
last post by:
Does anyone have a handy-dandy function they can quickly post that strips
everything from a string except for letters, numbers, & underscores?
--
http://www.sugapablo.com <--music ]
http://www.sugapablo.net <--personal ]
sugapablo@12jabber.com <--jabber IM ]
|
by: jel |
last post by:
I ran what was submitted in several forums, but it's not exactly what
i'm looking for. I'm dy'n over here. Ah, the frustrations of an
amateur programmer. I included the code below in c++. which details
what i'm looking for. I'm sure its just a small detail. But I'm in the
dark.
// numbers1to10only.cpp
#include <iostream.h>
|
by: stevenkobes |
last post by:
A lot of websites have forms with an image at the bottom containing
some distorted / noisy letters and numbers that users must type in to
prove they are real people. How do they normally implement that? Is
there any free server-side code out there to generate those images?
--Steve
|
by: techcs |
last post by:
Hi,
Wondering if anyine can help with the membership PHP script I lifted
from a tutorial. I'm new to PHP and have this system up and running but
my password only come out at three letters and sometime have a space in
them?? Anyway this is the code:
function makeRandomPassword($len = 8,$upper = 1,$number = 1) {
$salt = "abcdefghijklmnopqrstuvwxyz";
$uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
by: Kosmos |
last post by:
Since people have been so helpful on this site I thought I'd contribute what little I can...since I am not a programmer but I'm working on an access database for work
Anyways I had to remove letters from serial numbers so I could strip them down to their bare numbers. These serial numbers had the form of WAL28839940LT. The following code will help to strip off the letters at the end.
Option Compare Database
Public Function...
| |
by: Jeff |
last post by:
hey gang.
I have a code to create a random string of letters. The number of them can
be whatever I desire.
what i would like to do, is have it both letters and integers. how would i
modify this code to allow that.
'***** make random password ******
Sub StrRandomize(strSeed)
|
by: dpreston74 |
last post by:
Hello forum.
I need to learn how write a SQL script to strip 0s from data and strip alpha letters from alpha numeric data.
e.g.
I get data like 054, 006, 903, for a dept number. I need to strip the leading zeros from right. and keep the rest of the numbers. Whats the best way to script this striping?
Also,
|
by: Josh Mitchell |
last post by:
Hello,
Could anyone direct me to some sample script that makes a div or text visible only when a webform field in selected. So for example, in the below snippet, I want the text "Your username can only contain letters (A-Z) or numbers (0-9)" to be visible only when the user has selected "field1" in the form. Likewise, when the user leaves "field1," the text should become invisible again.
Many thanks!
Josh
<div id="username">...
|
by: sasimca007 |
last post by:
Hello friends,
We have seen many textboxes, it is used as date,readonly,text etc... If we want to restrict the textbox with not to enter letters only numbers and one more thing is restrict the letters in textbox to enter 4 letters only. How these r possible? Help me my friends.
|
by: Thekid |
last post by:
I had made a post about making a loop using letters instead of numbers and dshimer gave me this solution:
for i in range(65,70):
for j in range(65,70):
for k in range(65,70):
print chr(i),chr(j),chr(k)
which used an example I had posted using numbers. That code works (thanks dshimer) but after toying with it I see that I am going about it in a method that takes a long time to run through and I also need uppers in...
|
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...
| |
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,...
|
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...
|
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...
|
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...
|
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();...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |