hi all.
I got a urgent problem in my job.
the sample data as follows:
FT="EXERPRI:$68.88/10W*BB9505-28765710"
FT="MEETON6/3/07FOR
What I need is to extract the string after the quote and before any punctuation or integer so my outcome can be like this:
EXERPRI
MEETON
I use the SQL query as follows
SELECT Left([freetext],InStr([freetext],isnumeric())-1) AS Expr1
FROM Feb;
but it doesn't work. What can I do? Thanks a lot!
8 2464
hi all
I got a urgent problem in my job.
the sample data as follows:
FT="EXERPRI:$68.88/10W*BB9505-28765710"
FT="MEETON6/3/07FOR
What I need is to extract the string after the quote and before any punctuation or integer so my outcome can be like this:
EXERPRI
MEETON
I use the SQL query as follows
SELECT Left([freetext],InStr([freetext],isnumeric())-1) AS Expr1
FROM Feb;
but it doesn't work. What can I do? Thanks a lot!
FishVal 2,653
Recognized Expert Specialist
hi all.
I got a urgent problem in my job.
the sample data as follows:
FT="EXERPRI:$68.88/10W*BB9505-28765710"
FT="MEETON6/3/07FOR
What I need is to extract the string after the quote and before any punctuation or integer so my outcome can be like this:
EXERPRI
MEETON
I use the SQL query as follows
SELECT Left([freetext],InStr([freetext],isnumeric())-1) AS Expr1
FROM Feb;
but it doesn't work. What can I do? Thanks a lot!
Hi!
I can suggest the following.
Place the code below to a public module -
-
Option Compare Text ' to make "a"="A" return true
-
-
Public Function ExtractLeftString(ByVal varInput) As Variant
-
-
Dim intStringCursor As Integer, strChar As String
-
-
If IsNull(varInput) Then Exit Function
-
-
intStringCursor = 0
-
-
Do
-
intStringCursor = intStringCursor + 1
-
strChar = Mid(varInput, intStringCursor, 1)
-
Loop While strChar >= "a" And strChar <= "z"
-
-
ExtractLeftString = Left(varInput, intStringCursor - 1)
-
-
End Function
-
-
Pay attention to code row 1.
Now call this function from SQL query.
Good luck.
Lysander 344
Recognized Expert Contributor
hi all.
I got a urgent problem in my job.
the sample data as follows:
FT="EXERPRI:$68.88/10W*BB9505-28765710"
FT="MEETON6/3/07FOR
What I need is to extract the string after the quote and before any punctuation or integer so my outcome can be like this:
EXERPRI
MEETON
I use the SQL query as follows
SELECT Left([freetext],InStr([freetext],isnumeric())-1) AS Expr1
FROM Feb;
but it doesn't work. What can I do? Thanks a lot!
This function is quick and dirty but it works -
Function Startstring(ByVal strInput As String) As String
-
-
Dim i As Integer, intStop As Integer, strChar As String
-
intStop = 0
-
For i = 1 To Len(strInput)
-
strChar = Mid(strInput, i, 1)
-
If Asc(strChar) > 122 Or Asc(strChar) < 65 Then 'Not A-z
-
'need to set intStop at the 1st time only
-
If intStop = 0 Then intStop = i
-
End If
-
Next
-
'if intStop=0 then no bad chars
-
'if intStop=1 then all bad
-
If intStop = 0 Then
-
Startstring = strInput
-
ElseIf intStop = 1 Then
-
Startstring = ""
-
Else
-
Startstring = Left(strInput, intStop - 1)
-
End If
-
End Function
-
With a bit of time you can probaly put this in a do loop and exit the loop at the first non-alpha character
Lysander 344
Recognized Expert Contributor
Pay attention to code row 1.
Now call this function from SQL query.
Good luck.
Hi FishVal, guess we both answered the same problem at the same time. Your solution is neater though, like it.
hi all.
I got a urgent problem in my job.
the sample data as follows:
FT="EXERPRI:$68.88/10W*BB9505-28765710"
FT="MEETON6/3/07FOR
What I need is to extract the string after the quote and before any punctuation or integer so my outcome can be like this:
EXERPRI
MEETON
I use the SQL query as follows
SELECT Left([freetext],InStr([freetext],isnumeric())-1) AS Expr1
FROM Feb;
but it doesn't work. What can I do? Thanks a lot!
@OP: Next time please don't double post.
Threads merged.
Thanks a lot but the result comes in this way:
FT
FT
it only captures FT...Frustrated
Hi!
I can suggest the following.
Place the code below to a public module -
-
Option Compare Text ' to make "a"="A" return true
-
-
Public Function ExtractLeftString(ByVal varInput) As Variant
-
-
Dim intStringCursor As Integer, strChar As String
-
-
If IsNull(varInput) Then Exit Function
-
-
intStringCursor = 0
-
-
Do
-
intStringCursor = intStringCursor + 1
-
strChar = Mid(varInput, intStringCursor, 1)
-
Loop While strChar >= "a" And strChar <= "z"
-
-
ExtractLeftString = Left(varInput, intStringCursor - 1)
-
-
End Function
-
-
Pay attention to code row 1.
Now call this function from SQL query.
Good luck.
oh I changed
intStringCursor = 5
then it works PERFECTLY WELL!!!!
THANKS A LOT!!!!!!!!!!
Thanks a lot but the result comes in this way:
FT
FT
it only captures FT...Frustrated
FishVal 2,653
Recognized Expert Specialist
oh I changed
intStringCursor = 5
then it works PERFECTLY WELL!!!!
THANKS A LOT!!!!!!!!!!
Glad it was helpful.
You should replace
intStringCursor = 5
with
intStringCursor = 4
otherwise
ExtractLeftString ("FT=""12312")
will return
FT="1
instead of
FT="
Code below is more universal. -
-
Option Compare Text ' to make "a"="A" return true
-
-
Public Function ExtractString(ByVal varInput As Variant, _
-
Optional ByVal varStartSignature) As Variant
-
-
Dim intStart As Integer, intStringCursor As Integer, strChar As String
-
-
If IsNull(varInput) Then Exit Function
-
-
If IsMissing(varStartSignature) Or IsNull(varStartSignature) Then
-
intStringCursor = 0
-
Else
-
intStringCursor = InStr(1, varInput, varStartSignature) + _
-
Len(varStartSignature) - 1
-
End If
-
-
intStart = intStringCursor + 1
-
-
Do
-
intStringCursor = intStringCursor + 1
-
strChar = Mid(varInput, intStringCursor, 1)
-
Loop While strChar >= "a" And strChar <= "z"
-
-
ExtractString = Mid(varInput, intStart, intStringCursor - intStart)
-
-
End Function
-
-
Example
? ExtractString("FT=""qwerty123", "FT=""")
qwerty
? ExtractString("AnyName=""qwerty123", "AnyName=""")
qwerty
? ExtractString("qwerty123")
qwerty
Good luck.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Lauren Quantrell |
last post by:
This a a long convoluted string parsing question...
I have a string in an Access 2K database table field that I use for
noting if a user has checked a record.
The string goes like this:
xy
So...
|
by: Mohammad-Reza |
last post by:
Hi
I want to extract icon of an exe file and want to know how.
I look at the MSDN and find out that I can use ExtractIconEx() Windows API
but in there are some changes to that api in c# I made...
|
by: Barry |
last post by:
How can I open a word doc and extract the text as text without any
formatting characters??
--
Barry Fitzgerald
|
by: Patrick Sullivan |
last post by:
I am trying to extract two parts of a number from an array element. Numbers
are in the format of 1.10, 2.50, 11.10, etc. Floor and ceiling won't work
right because close to 1.00, I get a zero, and...
|
by: Adam Faulkner via DotNetMonster.com |
last post by:
I want to create a method within a class that opens a Microsoft Word 2000
Document and has the facility to Create a new word document and then extract
a Page that exists within the original Word...
| |
by: Tony Girgenti |
last post by:
Hello.
Using VS.NET 2003 VB. If i have a string similar to the attached, how would
i extract the "Truckname=" data from it in a loop and stay in the loop until
the end of the string is reached...
|
by: yinglcs |
last post by:
Hi,
how can I extract 2 integers from a string in python?
for example, my source string is this:
Total size: 173233 (371587)
I want to extract the integer 173233 and 371587 from that...
|
by: fool |
last post by:
Dear group,
Extract the integer value present in a given string. So I tried the
following:
int main(void)
{
int val;
char *data;
data = malloc(sizeof *data);
if(data)
|
by: Ben |
last post by:
Hi
We have a Dataset that has been populated from the output parameter of a
Stored Procedure (@Output).
I understand that I can extract a single item when the dataset is populated
by a table...
|
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,...
|
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: 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...
|
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,...
|
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: 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...
| |