473,405 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Assigning an Character

Hi everybody,

I have some n number of Names, the string i am declaring should take
any names,

for Ex: As for searching any file we use "*.*" is there any thing
simillar to this that i can use in VB code to specify any string.

Thanks & Regards
Anil.Hungund

Feb 21 '07 #1
4 1133
You can use the LIKE operator on strings:

If value Like "AB###" then ok = True

? = single character, * = 0 or more characters, # = single digit

You can include or exclude characters in the search by inserting a list
enclosed in a pair of sq brackets.

You exclude with !

If value Like "[A-C]####" then ok = true --1st is A B or C, then 4 digits

If value like "[!A-C]####" then ok = True --1st is not A or B or C, then
4 digits

Look for only alpha characters: If Not (value like (*[!A-Za-z]*")

Look for only digits: If Not (value like "*[0-9]*")

Look for any character but no consecutive punctuation symbols:

If Not (value Like "*[:;.,][:;.,]") then ok=true

This is faster than regex, but slower than manually comparing strings.

HTH,
Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
-----------------------------------------------
"anil" <an**********@gmail.comwrote in message
news:11**********************@k78g2000cwa.googlegr oups.com...
Hi everybody,

I have some n number of Names, the string i am declaring should take
any names,

for Ex: As for searching any file we use "*.*" is there any thing
simillar to this that i can use in VB code to specify any string.

Thanks & Regards
Anil.Hungund

Feb 21 '07 #2
anil wrote:
As for searching any file we use "*.*" is there any thing
simillar to this that i can use in VB code to specify any string.
Sounds like a pattern-matching issue to me:

The VB "Like" operator works as ever it did

? ( "Anil" Like "A*" )
True

Or you could delve into the murky depths of Regular Expressions

Imports System.Text.RegularExpressions

Dim re as New Regex( "^A" )
? re.IsMatch( "Anil" )
True

HTH,
Phill W.
Feb 22 '07 #3
Is there a pattern that will check a possible full path

C:dir1\dir2...\name.extension

to see if it is a valid string for the file system?

Thanks
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:7v******************************@comcast.com. ..
You can use the LIKE operator on strings:

If value Like "AB###" then ok = True

? = single character, * = 0 or more characters, # = single digit

You can include or exclude characters in the search by inserting a list
enclosed in a pair of sq brackets.

You exclude with !

If value Like "[A-C]####" then ok = true --1st is A B or C, then 4
digits

If value like "[!A-C]####" then ok = True --1st is not A or B or C, then
4 digits

Look for only alpha characters: If Not (value like (*[!A-Za-z]*")

Look for only digits: If Not (value like "*[0-9]*")

Look for any character but no consecutive punctuation symbols:

If Not (value Like "*[:;.,][:;.,]") then ok=true

This is faster than regex, but slower than manually comparing strings.

HTH,
Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
-----------------------------------------------
"anil" <an**********@gmail.comwrote in message
news:11**********************@k78g2000cwa.googlegr oups.com...
>Hi everybody,

I have some n number of Names, the string i am declaring should take
any names,

for Ex: As for searching any file we use "*.*" is there any thing
simillar to this that i can use in VB code to specify any string.

Thanks & Regards
Anil.Hungund


Mar 7 '07 #4
That sounds like a question for the Regular Expressions experts. Anyone?

Robin S.
--------------------------
" active" <ac**********@a-znet.comwrote in message
news:uA*************@TK2MSFTNGP06.phx.gbl...
Is there a pattern that will check a possible full path

C:dir1\dir2...\name.extension

to see if it is a valid string for the file system?

Thanks
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:7v******************************@comcast.com. ..
>You can use the LIKE operator on strings:

If value Like "AB###" then ok = True

? = single character, * = 0 or more characters, # = single digit

You can include or exclude characters in the search by inserting a list
enclosed in a pair of sq brackets.

You exclude with !

If value Like "[A-C]####" then ok = true --1st is A B or C, then 4
digits

If value like "[!A-C]####" then ok = True --1st is not A or B or C,
then 4 digits

Look for only alpha characters: If Not (value like (*[!A-Za-z]*")

Look for only digits: If Not (value like "*[0-9]*")

Look for any character but no consecutive punctuation symbols:

If Not (value Like "*[:;.,][:;.,]") then ok=true

This is faster than regex, but slower than manually comparing strings.

HTH,
Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
-----------------------------------------------
"anil" <an**********@gmail.comwrote in message
news:11**********************@k78g2000cwa.googleg roups.com...
>>Hi everybody,

I have some n number of Names, the string i am declaring should take
any names,

for Ex: As for searching any file we use "*.*" is there any thing
simillar to this that i can use in VB code to specify any string.

Thanks & Regards
Anil.Hungund



Mar 8 '07 #5

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

Similar topics

5
by: gtz669 | last post by:
I have a class which I am using for data stroage. I declare an instance of that class in my main class which is running my java applet. I Iassign it a value in the init () function and it works...
10
by: rxl124 | last post by:
I have files that I only need one field that I need to grep it out and I am trying to assign that to another file. (It happens that one field that I am looking for has some other character that...
4
by: Nathan Sokalski | last post by:
I have two databinding expressions (the first & last names from a DB) that I want to assign to the text property of a Label so that the result is LASTNAME,FIRSTNAME. At the moment, I have the...
16
by: John Salerno | last post by:
Let's say I'm making a game and I have this base class: class Character(object): def __init__(self, name, stats): self.name = name self.strength = stats self.dexterity = stats...
4
jeffbroodwar
by: jeffbroodwar | last post by:
Hello, i have a problem about assigning a char value to a byte... please check the code below : ======================================================== Scenario # 1 : This code doesn't work : ...
7
by: mcfaker | last post by:
hello , i've got a problem with C++ , in C++ :there is a type called char and i saw in a book that char only can be ONE character long , not more thn one . and i saw too that the character must be...
4
by: bindiya182003 | last post by:
Suppose if i want to enter a password how can i assign a password character like * in C program......How can i input the password displaying the password character
37
by: miken32 | last post by:
In PHP, if a function returns an array it's fairly common to capture its return values like this: <?php list($foo, $bar, $baz) = some_function_that_return_an_array(); ?> In Javascript, would...
7
by: jodleren | last post by:
Hi I have been looking into php.net, but could not find any proper description. There is a way of assigning variables from functions, while at the same time using them in e.g. an if. I have...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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...
0
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...
0
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,...
0
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...

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.