473,473 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

splitting a string into parts

375 Contributor
hello
I am having a huge string
eg. "The Scripts and The forums and the developer network and the discussions"

now i want to split the above into 4 strings
string 1="the scripts"
string 2="the forums"
string 3="the developer network"
string 4="the discussions"

I presume you got the question. Seperate the string wherever you find the occurence 'and'

Any help
thanks
Aug 23 '07 #1
3 1136
m6s
55 New Member
From the little I know,you should declare a string [] tmpvar
Then after declaring the string e.g. as string str = "asdfa asdf asdf "
do a use of str.slit(" ") and assign the results in tmpvar.

Somewhere I had seen something like that.
Hope it helps.
Aug 23 '07 #2
dip_developer
648 Recognized Expert Contributor
hello
I am having a huge string
eg. "The Scripts and The forums and the developer network and the discussions"

now i want to split the above into 4 strings
string 1="the scripts"
string 2="the forums"
string 3="the developer network"
string 4="the discussions"

I presume you got the question. Seperate the string wherever you find the occurence 'and'

Any help
thanks
Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim s2 As String="The Scripts and The forums and the developer network and the discussions"
  3. Dim stringSeparators() As String = {"and"}
  4. Dim splittedString() As String
  5. splittedString= s2.Split(stringSeparators, StrringSplitOptions.RemoveEmptyEntries)
  6.  
splittedString will hold the string array you want
you can have them like
string 1=splittedString(0)
string 2=splittedString(1)
string 3=splittedString(2)
string 4=splittedString(3)
Aug 23 '07 #3
cmrhema
375 Contributor
Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim s2 As String="The Scripts and The forums and the developer network and the discussions"
  3. Dim stringSeparators() As String = {"and"}
  4. Dim splittedString() As String
  5. splittedString= s2.Split(stringSeparators, StrringSplitOptions.RemoveEmptyEntries)
  6.  
splittedString will hold the string array you want
you can have them like
string 1=splittedString(0)
string 2=splittedString(1)
string 3=splittedString(2)
string 4=splittedString(3)

Thanks a bunch dop_developer
WORKING WONDERS.
Thanks again
Changed accordingly for VC#.
Aug 23 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Sandman | last post by:
I am splitting a text block into paragraphs, to be able to add images and stuff like that to a specific paragraph in a content management system. Well, right now I'm splittin on two or more...
3
by: Patrick Coleman | last post by:
Hi, I'm looking for a function to split urls into their component parts, ie protocol, host, path, filename, extension. I'm really only looking for path and hostname (so I can download a webpage...
2
by: Anat | last post by:
Hi, I need a little help on performing string manipulation: I want to take a given string, and make certain words hyperlinks. For example: "Hello world, this is a wonderful day!" I'd like the...
2
by: Matt | last post by:
Hi, I'm ridiculously new to Access (about a week!) so please be patient! My database is a record of British Standards. Each has a unique identifier. Some are split into parts. I would like...
2
by: CharChabil | last post by:
Using Vb.net 2005, I want to read each part in this string in an array (splitting the string) ----------- A1/EXT "BK82 LB73 21233" 105 061018 1804 ----------- That Code that i used is as follow:...
13
by: Pedro Pinto | last post by:
Hi there. I'm trying to do the following. I have a string, and i want to separate it into other halves. This is how it should be: char string = "test//test2//test3"; were // is the part...
5
by: mosscliffe | last post by:
I am looking for a simple split function to create a list of entries from a string which contains quoted elements. Like in 'google' search. eg string = 'bob john "johnny cash" 234 june' and...
4
by: yogi_bear_79 | last post by:
I have a simple string (i.e. February 27, 2008) that I need to split into three parts. The month, day, and year. Splitting into a string array would work, and I could convert day and years to...
2
by: 55chris55 | last post by:
say i have a 10 digit number how would i be able to split the string in a certain number of desired parts, say 3 example the number input is 0123456789 i want to split this to be 012 345
2
by: David Jackson | last post by:
Hello, The company I'm working for has taken over a smaller company with a fairly large customer base. We want to send an email to that customer base informing them of the takeover but the...
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
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...
1
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
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,...
1
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.