PC Review


Reply
Thread Tools Rate Thread

How do I find quotation marks in a string using INSTR? String exa.

 
 
=?Utf-8?B?R3JhbmRwYSBCZXJuaWU=?=
Guest
Posts: n/a
 
      3rd May 2006
If a string has a substring in quotes, how can I extract only the quoted
substring? Can it be done without writing code to loop through each
character in the string?
Example:
A field in a table has the value: Test Group: "NYS"; New York State
Assessment
I want to extract only the string in quotes: NYS

In particular, can this be done in a query using any combination of string
functions?
 
Reply With Quote
 
 
 
 
=?Utf-8?B?TGFycnk=?=
Guest
Posts: n/a
 
      3rd May 2006
It can, but it's ugly:

Mid([field],InStr([field],"""")+1,InStr(InStr([field],"""")+1,[field],"""")-InStr([field],"""")-1)


"Grandpa Bernie" wrote:

> If a string has a substring in quotes, how can I extract only the quoted
> substring? Can it be done without writing code to loop through each
> character in the string?
> Example:
> A field in a table has the value: Test Group: "NYS"; New York State
> Assessment
> I want to extract only the string in quotes: NYS
>
> In particular, can this be done in a query using any combination of string
> functions?

 
Reply With Quote
 
=?Utf-8?B?TGFycnlQ?=
Guest
Posts: n/a
 
      3rd May 2006
You might try using Chr(34) in your string searches rather than trying to
search for ", which kinda drives most functions/queries/SQL nuts.

"Grandpa Bernie" wrote:

> If a string has a substring in quotes, how can I extract only the quoted
> substring? Can it be done without writing code to loop through each
> character in the string?
> Example:
> A field in a table has the value: Test Group: "NYS"; New York State
> Assessment
> I want to extract only the string in quotes: NYS
>
> In particular, can this be done in a query using any combination of string
> functions?

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Quotation marks in String Nathan Microsoft Excel Discussion 2 8th Mar 2005 09:30 AM
Quotation marks in string =?Utf-8?B?S2Vu?= Microsoft Access Form Coding 1 28th Dec 2004 12:18 AM
Re: Quotation marks in a string Phobos Microsoft Excel Misc 0 14th Sep 2003 06:51 PM
Re: Quotation marks in a string Earl Kiosterud Microsoft Excel Misc 0 14th Sep 2003 05:35 PM
Re: Quotation marks in a string Andy Brown Microsoft Excel Misc 0 14th Sep 2003 04:40 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:40 PM.