473,406 Members | 2,273 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Spliting Large String

I have a string that contains something along the lines of this:

This is a body of an e-mail message. I have no idea how long it goes, how
it ends, etc.

------ Do not modify below ------
<query>filename.csv</query>

I need to split the string into two parts. The body of the message part,
and I need to extract the filename between the <query> brackets. What's the
best way to go about this? I was thinking I could find the index of "------
Do not modify below ------" but that seems like a flakey way to do it.
Nov 16 '05 #1
3 2604
Well, you could us a regex, but that seems like unnecessary overkill. I
don't know what you mean exactly by "flakey", but using IndexOf to find the
<query> and the </query> and then Substring to get the part in between seems
straightforward enough to me. I would think any alternative you devised
would look just as "flakey" as IndexOf.
"- Steve -" <se****@foundation.sdsu.edu> wrote in message
news:Oi**************@TK2MSFTNGP14.phx.gbl...
I have a string that contains something along the lines of this:

This is a body of an e-mail message. I have no idea how long it goes, how
it ends, etc.

------ Do not modify below ------
<query>filename.csv</query>

I need to split the string into two parts. The body of the message part,
and I need to extract the filename between the <query> brackets. What's the best way to go about this? I was thinking I could find the index of "------ Do not modify below ------" but that seems like a flakey way to do it.

Nov 16 '05 #2
If you're only searching it once, I don't see anything wrong with using
IndexOf(). You might consider using regular expressions if you expect to
search more than once.
Tom Clement
Apptero, Inc.
"- Steve -" <se****@foundation.sdsu.edu> wrote in message
news:Oi**************@TK2MSFTNGP14.phx.gbl...
I have a string that contains something along the lines of this:

This is a body of an e-mail message. I have no idea how long it goes, how
it ends, etc.

------ Do not modify below ------
<query>filename.csv</query>

I need to split the string into two parts. The body of the message part,
and I need to extract the filename between the <query> brackets. What's
the best way to go about this? I was thinking I could find the index of
"------ Do not modify below ------" but that seems like a flakey way to
do it.

Nov 16 '05 #3
Steve,

If you want to allow for the unlikely eventuality that your body also
contains the mark

"------ Do not modify below ------"

(ie. it occurs twice) then use the method LastIndexOf

Phil...
"- Steve -" <se****@foundation.sdsu.edu> wrote in message
news:Oi**************@TK2MSFTNGP14.phx.gbl...
I have a string that contains something along the lines of this:

This is a body of an e-mail message. I have no idea how long it goes, how
it ends, etc.

------ Do not modify below ------
<query>filename.csv</query>

I need to split the string into two parts. The body of the message part,
and I need to extract the filename between the <query> brackets. What's
the best way to go about this? I was thinking I could find the index of
"------ Do not modify below ------" but that seems like a flakey way to
do it.

Nov 16 '05 #4

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

Similar topics

2
by: Sebek | last post by:
Hello, I'm transforming a XML document in XHTML but I have problems using sub-strings, it will be clearer with an exemple: What I have: <form...
9
by: Sreejith S S Nair | last post by:
hi there, I have a panel control which contain more than 10 label controls. these label controls are added dynamically by user. In this application user can slit a control into not less than...
0
by: Sreejith S S Nair | last post by:
hi, Setp one. i have one panel control in my form. I am spliting this panel control into two part say working region and holding region. This spliting is only logic spliting. That is i...
5
by: LU | last post by:
VAR1 = 3/4 VAR2 = 2 I user can submit the values "3/4" or "2" (VAR1, VAR2 represent any numbers) when user submits "3/4" we assume 1sthalf/2ndhalf These values are saved into database as a row...
0
by: wrytat | last post by:
In one web page, I redirect it to "prtDelReq.aspx?prtindex=0A2A3A8" after the user click the button. The prtindex actually contains many integers separated by 'A'. On the prtDelReq page, I use...
2
by: Jon | last post by:
Hello all, I was wondering if someone could give me a quick bit of help! I have a string such as the below name$id|type,name$id|type,name$id|type that I split on the , to create
8
by: Jack | last post by:
Hello, I need to split: 2 1066 1.30 172.90 1065.9 -14.2 3.0 -13.3 0.1 3 1528 1.00 188.10 1527.8 -23.3 3.0 -20.9 0.1 4 2007 0.60 182.60 2006.7 -30.0 2.3 -25.9 0.1 5 2484 1.00 195.20 2483.7...
1
by: sivanandan | last post by:
Hi I Pass The 3 String Value Like "1,2,3" 2nd String "x,y,z" 3rd String "a,b,c" Spilit The Those String Values And Compare The Value"1" Into Table The Table Contain Data Only One...
0
by: =?Utf-8?B?SHVzYW0=?= | last post by:
Hi EveryBody: Can Some body tell me by using VB.Net 2005 how can I split large file let's say 3 GB sizw to pices each pice are 3 MB size? any help or redirection wil be appreciated regar's...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
tracyyun
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...
0
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,...
0
isladogs
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 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.