Hi;
I am trying to extract a substring using a combination of the mid() and
Instr() i.e.
aString = "Jones, Thomas R, Dr."
hold = InStr(1, aString, " ," , 1)
newString = Mid(aString, 1, hold) + Mid(aString, hold + 2, InStr(hold + 1,
aString, " ", 1))
I want to trim the middle initial and title and keep only last name, comma
and first name.
Any suggestions as to what I am doing wrong here ? Mid$(aString, hold + 2,
InStr(hold + 1, aString, " ", 1))
There is probably some method of the string object that I need to use
instead of those string functions. Right ?
Thanks,
--
Gordon 4 1976
Gordon,
When it is not about millions of names because it is slower (not terrible
however it is), than I would probably in your case use the split with a
delimited string. http://msdn.microsoft.com/library/de...SplitTopic.asp
The two first (or probably the first and the thirth) in the array are than
what you need.
I hope this helps,
Cor
Hi,
Dim s as string = "Jones, Thomas R, Dr."
dim strComma() as string = s.split(","c)
dim strSpace() as string = strComma(1).Trim.Split(" "c)
Debug.Writeline(strComma(0) & ", " & strSpace(0))
Ken
---------------------------
"Gordon" wrote: Hi;
I am trying to extract a substring using a combination of the mid() and Instr() i.e.
aString = "Jones, Thomas R, Dr."
hold = InStr(1, aString, " ," , 1)
newString = Mid(aString, 1, hold) + Mid(aString, hold + 2, InStr(hold + 1, aString, " ", 1))
I want to trim the middle initial and title and keep only last name, comma and first name.
Any suggestions as to what I am doing wrong here ? Mid$(aString, hold + 2, InStr(hold + 1, aString, " ", 1))
There is probably some method of the string object that I need to use instead of those string functions. Right ?
Thanks, -- Gordon
Ken,
I had the idea that the result would have to be Thomas Jones.
By the way, what is in the USA the first name.
Ken
Kenneth
Kenneth X
By us it is
Cor = Firstname
Cornelis = official firstname or Christianname (seldom used as firstname or
it should be more foreign names)
Cornelis Johannes Marinus = All firstnames (can be one until whatever
amount)
Cor
Thanks for your suggestions.
"Gordon" wrote: Hi;
I am trying to extract a substring using a combination of the mid() and Instr() i.e.
aString = "Jones, Thomas R, Dr."
hold = InStr(1, aString, " ," , 1)
newString = Mid(aString, 1, hold) + Mid(aString, hold + 2, InStr(hold + 1, aString, " ", 1))
I want to trim the middle initial and title and keep only last name, comma and first name.
Any suggestions as to what I am doing wrong here ? Mid$(aString, hold + 2, InStr(hold + 1, aString, " ", 1))
There is probably some method of the string object that I need to use instead of those string functions. Right ?
Thanks, -- Gordon This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: David |
last post by:
Hi,
Quick question.
If I have a recordset value in RS("ProductName"), is it possible to
test for a part string in this value ?
I would be looking for all products starting 'Blue' and with...
|
by: DTB |
last post by:
I am trying to convert a complex function from Oracle to SQL Server
and have come across Oracle's Instr() function. I see SQL Server has
CHARINDEX() which is similar, however it does not provide...
|
by: Gregory A Greenman |
last post by:
I'm trying to write a program in vb.net to automate filling out a
series of forms on a website. There are three forms I need to
fill out in sequence. The first one is urlencoded. My program is...
|
by: Grasshopper |
last post by:
Hi,
I am automating Access reports to PDF using PDF Writer 6.0. I've
created a DTS package to run the reports and schedule a job to run this
DTS package. If I PC Anywhere into the server on...
|
by: Daveyk0 |
last post by:
Hello there,
I have a front end database that I have recently made very many changes
to to allow off-line use. I keep copies of the databases on my hard
drive and link to them rather than the...
| |
by: martlaco1 |
last post by:
Trying to fix a query that (I thought) had worked once upon a time, and
I keep getting a Data Type Mismatch error whenever I enter any criteria
for an expression using a Mid function. Without the...
|
by: mookie |
last post by:
m looking to create something similar to #region and #endregion using
treeviews
the problem is that instead of #region, i am using ;fold and ;endfold
i am also allowed ot have a fold within...
|
by: ransoma22 |
last post by:
I developing an application that receive SMS from a connected GSM
handphone, e.g Siemens M55, Nokia 6230,etc through the data cable.
The application(VB.NET) will receive the SMS automatically,...
|
by: deancarstens |
last post by:
Hi,
This is a tougher one, but I'm quite sure someone will have a solution
for this. Of course, a last minute thing thrown at me by my boss.
I have a unique identifier consisting of regions,...
|
by: Pinna |
last post by:
Hiya, I am trying to select based on a range on postcode on a table. The field POSTCODE is a varchar2(8).
The problem is when refinng on 'where postcode between 'PE1' and 'PE29'', because this is...
|
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...
| |
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...
|
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...
|
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: 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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 ...
|
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...
| |