473,405 Members | 2,154 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,405 software developers and data experts.

'Exploding' a string to an arraylist

HELP!!!!

I have a string (never mind how it got that way) :-) that looks like this:

Building Operations[]Administrative Services
where [] = chr(10)

(It came from an XML Schema out of an InfoPath Merged Field document, but
that is unimportant at this point)

I need to take that string, and regardless of the number of [], load each
ordinal into it's own index of an arraylist that looks like this:

index|value
-----------
0 | Building Operations
1 | Administrative Services
Can someone show me some code to do that?

Thanks!
Derek
Nov 20 '05 #1
2 994
See the String.Split() method.

"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> wrote in message
news:O$**************@TK2MSFTNGP09.phx.gbl...
HELP!!!!

I have a string (never mind how it got that way) :-) that looks like this:

Building Operations[]Administrative Services
where [] = chr(10)

(It came from an XML Schema out of an InfoPath Merged Field document, but
that is unimportant at this point)

I need to take that string, and regardless of the number of [], load each
ordinal into it's own index of an arraylist that looks like this:

index|value
-----------
0 | Building Operations
1 | Administrative Services
Can someone show me some code to do that?

Thanks!
Derek

Nov 20 '05 #2
Wow, that was fast - and bingo! Just what I needed...now it is time for fun
with loops!
:-)
"Russell Jones" <ar**@nospam.northstate.net> wrote in message
news:eE**************@TK2MSFTNGP09.phx.gbl...
See the String.Split() method.

"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> wrote in message
news:O$**************@TK2MSFTNGP09.phx.gbl...
HELP!!!!

I have a string (never mind how it got that way) :-) that looks like this:
Building Operations[]Administrative Services
where [] = chr(10)

(It came from an XML Schema out of an InfoPath Merged Field document, but that is unimportant at this point)

I need to take that string, and regardless of the number of [], load each ordinal into it's own index of an arraylist that looks like this:

index|value
-----------
0 | Building Operations
1 | Administrative Services
Can someone show me some code to do that?

Thanks!
Derek


Nov 20 '05 #3

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

Similar topics

1
by: Walter Zydhek | last post by:
Is it possible to convert an ArrayList to a string array? I have a routine that takes a string array as a parameter, converts it to an ArrayList for manipulation purposes, and now I need to...
6
by: Dan V. | last post by:
I would like to create a 2D string list (2D ArrayList ???). I would like to pass in a table or query as a parameter and have both columns transform into a 2D ArrayList. When I sort the one...
9
by: ad | last post by:
I have a string like "1,2,2,3,3,3,4" I want to trim off the duplicate part, and make it to "1,2,3,4" How can I do?
12
by: DumberThanSnot | last post by:
is there a faster way to copy an ArrayList of strings to a string other than a tight loop. In it's most simple terms, I'm currently using something like this... ---------------------------- ...
5
by: Paulers | last post by:
Hello all, I have a string array with duplicate elements. I need to create a new string array containing only the unique elements. Is there an easy way to do this? I have tried looping through...
10
by: chrisben | last post by:
Hi, Here is the scenario. I have a list of IDs and there are multiple threads trying to add/remove/read from this list. I can do in C# 1. create Hashtable hList = Hashtable.Synchronized(new...
8
by: Pim75 | last post by:
Hello, I'm defining a string array like: Dim strArray() As String = {"1", "2"} Can I add some values to this string array later in the code? It's not clear to me how to do this. I hope...
2
by: YASIN786 | last post by:
hi all i am helping a friend to develop a java program to implement the following features but i cannot understand how to go about this problem. A text file contains a number of English...
5
by: blt51 | last post by:
I need to write a program that handles a bank account and does a number of transactions using an arraylist. However, I'm having trouble getting the arraylist to store all the transactions and then...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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,...
0
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...
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.