Hello all,
I have a string for example :
strTest = "a lineof text (60) witha number in it"
I need to extract the number from between the brackets, the postion of
the number in brackets is never the same...
So in the above example i need to extract 60
Anyone help on how to do this the simplest way ?
Thanks
andy 6 2017
"androoo" <an**@northwave s.comwrote in news:1164034942 .891789.106920
@m73g2000cwd.go oglegroups.com:
Hello all,
I have a string for example :
strTest = "a lineof text (60) witha number in it"
I need to extract the number from between the brackets, the postion of
the number in brackets is never the same...
So in the above example i need to extract 60
Anyone help on how to do this the simplest way ?
I would use regular expressions - you can specific the search pattern to
only search for numeric characters... like:
[0-9](1,) which will search for 1 or more numeric characters.
thanks, im a bit new to regular expressions but will have a go
Spam Catcher wrote:
"androoo" <an**@northwave s.comwrote in news:1164034942 .891789.106920
@m73g2000cwd.go oglegroups.com:
Hello all,
I have a string for example :
strTest = "a lineof text (60) witha number in it"
I need to extract the number from between the brackets, the postion of
the number in brackets is never the same...
So in the above example i need to extract 60
Anyone help on how to do this the simplest way ?
I would use regular expressions - you can specific the search pattern to
only search for numeric characters... like:
[0-9](1,) which will search for 1 or more numeric characters.
This can work but it is incredibly weak:
Dim strTest As String = "a lineof text (60) witha number in it"
Dim Results As String() = strTest.Split(N ew Char() {"("c,
")"c}, 3)
If Results.Length = 3 Then
Console.Write(" I found " & Results(1) & vbCrLf)
End If
androoo wrote:
thanks, im a bit new to regular expressions but will have a go
Spam Catcher wrote:
"androoo" <an**@northwave s.comwrote in news:1164034942 .891789.106920
@m73g2000cwd.go oglegroups.com:
Hello all,
>
I have a string for example :
>
strTest = "a lineof text (60) witha number in it"
>
I need to extract the number from between the brackets, the postion of
the number in brackets is never the same...
>
So in the above example i need to extract 60
>
Anyone help on how to do this the simplest way ?
I would use regular expressions - you can specific the search pattern to
only search for numeric characters... like:
[0-9](1,) which will search for 1 or more numeric characters.
thanks for your help :)
I will try it out
FishingScout wrote:
This can work but it is incredibly weak:
Dim strTest As String = "a lineof text (60) witha number in it"
Dim Results As String() = strTest.Split(N ew Char() {"("c,
")"c}, 3)
If Results.Length = 3 Then
Console.Write(" I found " & Results(1) & vbCrLf)
End If
androoo wrote:
thanks, im a bit new to regular expressions but will have a go
Spam Catcher wrote:
"androoo" <an**@northwave s.comwrote in news:1164034942 .891789.106920
@m73g2000cwd.go oglegroups.com:
>
Hello all,
I have a string for example :
strTest = "a lineof text (60) witha number in it"
I need to extract the number from between the brackets, the postion of
the number in brackets is never the same...
So in the above example i need to extract 60
Anyone help on how to do this the simplest way ?
>
I would use regular expressions - you can specific the search pattern to
only search for numeric characters... like:
>
[0-9](1,) which will search for 1 or more numeric characters.
Hey Androo,
Try this code:
'
' Create a regex object
'
dim myRegex as new
System.Text.Reg ularExpressions .Regex("(?<numb er>\d+)")
'
' Collect our input string
'
dim myInputString as string = "a lineof text (60) witha number in it"
'
' Capture our input
'
dim myNumber as string =
myRegex.Match(m yInputString).G roups("number") .Value
'
' Use it as we will
'
Console.WriteLi ne(myNumber)
On 21 Nov 2006 11:47:55 -0800, "androoo" <an**@northwave s.comwrote:
>thanks, im a bit new to regular expressions but will have a go
Spam Catcher wrote:
>"androoo" <an**@northwave s.comwrote in news:1164034942 .891789.106920 @m73g2000cwd.g ooglegroups.com :
Hello all,
I have a string for example :
strTest = "a lineof text (60) witha number in it"
I need to extract the number from between the brackets, the postion of
the number in brackets is never the same...
So in the above example i need to extract 60
Anyone help on how to do this the simplest way ?
I would use regular expressions - you can specific the search pattern to only search for numeric characters... like:
[0-9](1,) which will search for 1 or more numeric characters.
--
Bits.Bytes. http://bytes.thinkersroom.com
Androoo,
You should use Rad's solution.
androoo wrote:
thanks for your help :)
I will try it out
FishingScout wrote:
This can work but it is incredibly weak:
Dim strTest As String = "a lineof text (60) witha number in it"
Dim Results As String() = strTest.Split(N ew Char() {"("c,
")"c}, 3)
If Results.Length = 3 Then
Console.Write(" I found " & Results(1) & vbCrLf)
End If
androoo wrote:
thanks, im a bit new to regular expressions but will have a go
>
Spam Catcher wrote:
"androoo" <an**@northwave s.comwrote in news:1164034942 .891789.106920
@m73g2000cwd.go oglegroups.com:
Hello all,
>
I have a string for example :
>
strTest = "a lineof text (60) witha number in it"
>
I need to extract the number from between the brackets, the postion of
the number in brackets is never the same...
>
So in the above example i need to extract 60
>
Anyone help on how to do this the simplest way ?
I would use regular expressions - you can specific the search pattern to
only search for numeric characters... like:
[0-9](1,) which will search for 1 or more numeric characters.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jaime Wyant |
last post by:
Will someone explain this to me?
>>> "test".find("")
0
Why is the empty string found at position 0?
Thanks!
jw
|
by: Chris Thunell |
last post by:
I'm looking to find in a long string an instance of 4 numbers in a row, and
pull out those numbers.
For instance:
string = "0104 PBR", i'd like to get the 0104.
string="PBR XT 0105 TD", i'd like to get the 0105.
The numbers will always be 4 digits together.
(I'm using vb.net)
Any help would be greatly appreciated!
Chris
cthunell@pierceassociates.com
|
by: ashmangat |
last post by:
Hi!
now on the chapter "string-class" My assignment is below Word Counter:
Write a function that accepts a pointer to a C-String as an argument
and returns the number of words contained in the string. For instance,
if the string argument is "Four score and seven years ago" the function
should return the number 6. Demonstrate the function in a program that
asks the user to input a string and then passes it to the function. The
number of...
|
by: vmoreau |
last post by:
I have a text and I need to find a Word that are not enclosed in
paranthesis. Can it be done with a regex? Is someone could help me?
I am not familar with regex...
Example looking for WORD:
(there is a WORD in ( my string WORD )) and * WORD * to (find WORD)
and * WORD *
Should give me the to word between star (star ar not part of string)
|
by: Oliver Bleckmann |
last post by:
hi there,
i tried a lot, but it does not work correctly
it is more copied to the substr than expected,
should be only a "<tag>" but outputs "<tag>etc"
shuld parse a xml file like that:
<?xml version="1.0" encoding="iso8859-1"?>
<Hotel id="0" version="0">
<Room id=>
<number>0</number>
| |
by: blyxx86 |
last post by:
Hi everyone,
I am using some VB code to have a "Notes" table be stored for use on all forms that relates to the specific record in any other table.
(I haven't used the terminology in a while, but i believe the FK is the primary key of another table???)
I have created a table of all the tables in my database:
tblTableList
TableID; AutoNumber; PK
TableName; String
DateAdded: Date/Time
|
by: Karthik01 |
last post by:
Hi,
i have written a VB script to find a node name in an XML.Now i need to search for that node name in another XML. How can i do it.
My XML looks like this
- <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
- <s:Schema id="RowsetSchema">
- <s:ElementType name="row" content="eltOnly">
- <s:AttributeType...
|
by: Steve Richter |
last post by:
Does the .NET framework provide a class which will find the item in
the collection with a key which is closest ( greater than or equal,
less than or equal ) to the keys of the collection?
ex: collection keys are 20, 30, 40, 50, 60, 70, 80
find key which is >= 35.
would return the 30 key.
|
by: karinmorena |
last post by:
I'm having 4 errors, I'm very new at this and I would appreciate your input. The error I get is:
Week5MortgageGUI.java:151:cannot find symbol
symbol: method allInterest(double,double,double)
Location: class Week5MortgageGUI
Week5MortgageLogic allint = logic.allInterest(amount, term, rate);
Week5MortgageGUI.java:152:cannot find symbol
symbol: method allInterest(double,double,double)
Location: class Week5MortgageGUI
|
by: zephyrus360 |
last post by:
This is about a technique to find the mod of a very large integer with a normal small integer.
I recently encountered this problem when I needed to compute the modulus of a very large number with a normal integer. I needed this in a C++ program running on a 32-bit UNIX platform. The problem was that the number was 28 digits long and no native datatype in c++ could store a number of that size.
(Eg: 1088263455689473669888943602 % 380)
Not...
|
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: 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: 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 we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |