473,569 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Grab data from string

Hi,

I have a string with a lot of text. I want to filter out some data. I know
some characters before and after the wanted data.

I know that there is a substring method but this one use a fixed length, a
length I don't know.

How can I retriew the middle data, having a string before and after that
data?

Thanks!
Arjen
Apr 20 '07 #1
4 1411
Sounds like a regex to me... google for regex if you aren't familiar

Marc
Apr 20 '07 #2
Arjen wrote:
Hi,

I have a string with a lot of text. I want to filter out some data. I
know some characters before and after the wanted data.

I know that there is a substring method but this one use a fixed
length, a length I don't know.

How can I retriew the middle data, having a string before and after
that data?
Using regular expressions (which are directly supported by the .NET
framework) might do the trick. It does depend on the nature of your data,
though.

Ebbe
Apr 20 '07 #3
If you know the chars before and after then use indexof to identify where in
your string the identifiable bits are - and just pull out the middle using
substring and the values indexof provided.

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog
"Arjen" <bo*****@hotmai l.comwrote in message
news:f0******** **@news1.zwoll1 .ov.home.nl...
Hi,

I have a string with a lot of text. I want to filter out some data. I know
some characters before and after the wanted data.

I know that there is a substring method but this one use a fixed length, a
length I don't know.

How can I retriew the middle data, having a string before and after that
data?

Thanks!
Arjen

Apr 20 '07 #4
Thanks!

Arjen
"John Timney (MVP)" <x_****@timney. eclipse.co.uksc hreef in bericht
news:_J******** *************** *******@eclipse .net.uk...
If you know the chars before and after then use indexof to identify where
in your string the identifiable bits are - and just pull out the middle
using substring and the values indexof provided.

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog
"Arjen" <bo*****@hotmai l.comwrote in message
news:f0******** **@news1.zwoll1 .ov.home.nl...
>Hi,

I have a string with a lot of text. I want to filter out some data. I
know some characters before and after the wanted data.

I know that there is a substring method but this one use a fixed length,
a length I don't know.

How can I retriew the middle data, having a string before and after that
data?

Thanks!
Arjen


Apr 20 '07 #5

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

Similar topics

0
2710
by: Baby Blue | last post by:
I have 2 code like below to grab a news website for my site. However, when I click some links (such as : http://wwww.vnexpress.net/xxx/xxxx ) inside the site which I want to grab, it has some errors. Can any body help me ?? Demo : news.thuthao.info The real website : vnexpress.net ...
8
3443
by: gregory_may | last post by:
Is there a way to grab a "Screen Shot" that includes "Tool Tips"? I saw this code someplace, cant remember where. But it doesnt grab "Tool Tips". Is there a better way to do this in .net? Thanks! Private Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" (ByVal lpDriverName As String, ByVal lpDeviceName As String, ByVal lpOutput...
3
1359
by: Andy Kasotia | last post by:
On the client once the user clicks the Submit button....in my code the following javascript function kicks off... onclick="return SubmitForm('frmCurrBuildings', 'CurrBuildings.asp', c_iLOADNEW, '_self')" function SubmitForm( FormName, ActionASP, ActionVal, TargetVal ) eval( "document." + FormName + ".target = '" + TargetVal + "'" ) ; eval(...
10
1422
by: Jonathan Schwarz via DotNetMonster.com | last post by:
Hi folks, I am a complete newbie to ASP.NET, VB, etc... I am coming from a Cold Fusion background where it only takes me 4 lines to query a MSSQL db and display a field name. Please, how do I connect to my SQL db using the DSN ("mydsnname") and then select "thisfieldname" from "thistablename". Then how do i display the value in my html...
4
5567
by: Ken Swanson | last post by:
Hi, In VB.NET, how do I determine what filename has been dropped into a ListView? In my ListView's DragEnter() event, I am trying this, which according to the Help, should work: MyFilename = e.Data.GetData("FileName").ToString I have also tried e.Data.GetData(DataFormats.Text) and GetData(System.String)... neither work. I keep...
5
1275
by: darrel | last post by:
I'm having a really odd problem that I can't find many other examples of. I'm using XMLTextWriter and grabbing data from a database and then spitting out an RSS-compliant XML file. The problem I have is that, by default, IE pukes on it. If I output the XMLTextWriter as: XmlTextWriter(Response.OutputStream, Encoding.UTF8)
4
1360
by: Prodian | last post by:
Im trying to parse a recv from a telnet session then only grab certain data. Heres an example of the recv that Im storing into a string: Internet 204.189.124.205 0 001a.a01f.4e5a ARPA Vlan122 The only part I want is the mac address which is in bold. Im trying to parse it while running it into a for loop so when it gets to...
19
1861
by: JRough | last post by:
I have used this function to create a string called $headers: function GetHeaders($file_name){ return "<th><a href='".$file_name."&order_by=l_e'>L_E</a></th> <th><a href='". $file_name."&order_by=carnumber'>Carnumber</a></th> <th><a href='". $file_name."&order_by=location'>Location</a></th> <th><a href='"....
0
7697
marktang
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...
0
7612
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...
0
7924
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8120
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6283
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3653
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...
1
2113
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
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
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...

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.