473,700 Members | 2,899 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Splitting Strings

15 New Member
I want to split a string based on a pattern. my string is something like this.

10/8/2007 5:03:06 PM thakurab *************RE CIVED MAIL FROM MIKE FOR THE PQR AND DPS CRETION******** *************** PQR Start Time: 10/08/07 16:29:09 New PQR State: Assigned Respond Due Date: 10/09/07 00:29:09 Resolve Due Date: 10/10/07 16:29:09 Resolved On: 10/8/2007 5:23:40 PM pandeyra



usually, there is date/time in the start of sentence followed by the name(thakurab, in this case). the string has to split after this combination. the result shuld be something like this:




10/8/2007 5:03:06 PM thakurab

*************RE CIVED MAIL FROM MIKE FOR THE PQR AND DPS CRETION******** *************** PQR Start Time: 10/08/07 16:29:09 New PQR State: Assigned Respond Due Date: 10/09/07 00:29:09 Resolve Due Date: 10/10/07 16:29:09

10/8/2007 5:23:40 PM pandeyra


plz guide me through this. Also, will regex help in achieving this?

Thanks,
Prasanna.
Oct 11 '07 #1
4 1305
nateraaaa
663 Recognized Expert Contributor
Where are your strings coming from? XML, database, textfile? If you know the name that you are looking for you could use the IndexOf method to find the name then insert a <br> tag to create a new line. Provide more info please.

Nathan
Oct 11 '07 #2
Shashi Sadasivan
1,435 Recognized Expert Top Contributor
What happened to "Resolved On: " ? :P
yes regex will seem to be very helpful as you know you have to find the indexes of the dates.
Except you have to figure out which date to split the string from.

cheers
Oct 11 '07 #3
KnightHack
15 New Member
You have to know 1st format

inside this string getting 2 date times and

everytime the format is changing,if you use regex also be how u get,

TRY THIS

dim str as string = "ffdfdsf f23183913 fdsfsf ********* "

STR = STR.SUBSTRING(0 OR 1 ,INSTR(STR,"**" ) - 0 OR 1)
GOOD LUCK
Oct 12 '07 #4
r035198x
13,262 MVP
Will the String.Split method help?
Oct 12 '07 #5

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

Similar topics

3
2190
by: Piet | last post by:
Hello, I have a very strange problem with regular expressions. The problem consists of analyzing the properties of columns of a MySQL database. When I request the column type, I get back a string with the following composition: vartype(width|list) further variable attributes. vartype is a simple string(varchar, tinyint ...) which might be followed by a string in curved brackets. This bracketed string is either composed of a single...
5
5354
by: Steven Bethard | last post by:
Here's what I'm doing: >>> lst = >>> splits = >>> for s in lst: .... pair = s.split(':') .... if len(pair) != 2: .... pair.append(None) .... splits.append(pair) ....
7
2230
by: qwweeeit | last post by:
Hi all, I am writing a script to visualize (and print) the web references hidden in the html files as: '<a href="web reference"> underlined reference</a>' Optimizing my code, I found that an essential step is: splitting on a word (in this case 'href'). I am asking if there is some alternative (more pythonic...): # SplitMultichar.py
9
14724
by: Dr. StrangeLove | last post by:
Greetings, Let say we want to split column 'list' in table lists into separate rows using the comma as the delimiter. Table lists id list 1 aa,bbb,c 2 e,f,gggg,hh 3 ii,kk 4 m
5
2965
by: fatted | last post by:
I'm trying to write a function which splits a string (possibly multiple times) on a particular character and returns the strings which has been split. What I have below is kind of (oh dear!) printing the results I expect, which I guess means my dynamic memory allocation is a mess. Also, I was advised previously that I should really free memory in the same place I declare it, but I'm not sure how I would go about doing this in my code...
2
2520
by: Trint Smith | last post by:
Ok, My program has been formating .txt files for input into sql server and ran into a problem...the .txt is an export from an accounting package and is only supposed to contain comas (,) between fields in a table...well, someone has been entering description fields with comas (,) in the description and now it is splitting between one field...example: "santa clause mushrooms, pens, cups and dolls" I somehow need to NOT split anything...
20
3704
by: Opettaja | last post by:
I am new to c# and I am currently trying to make a program to retrieve Battlefield 2 game stats from the gamespy servers. I have got it so I can retrieve the data but I do not know how to cut up the data to assign each value to its own variable. So right now I am just saving the data to a txt file and when I look in the text file all the data is there. Not sure if this matters but when I open the text file in Word pad (Rich Text) It...
2
3268
by: shadow_ | last post by:
Hi i m new at C and trying to write a parser and a string class. Basicly program will read data from file and splits it into lines then lines to words. i used strtok function for splitting data to lines it worked quite well but srttok isnot working for multiple blank or commas. Can strtok do this kind of splitting if it cant what should i use . Unal
4
2535
by: techusky | last post by:
I am making a website for a newspaper, and I am having difficulty figuring out how to take a string (the body of an article) and break it up into three new strings so that I can display them in the traditional newspaper column format. For instance, say the string $articleBody contains a 600 word article. What I want to do is break $articleBody up into three new strings in a format such as this: $string1 contains words 0-200 from...
4
1637
by: Eyes Of Madness | last post by:
I'm doing a program for a class of mine and I am having trouble splitting my strings up. I know you can do something like: a = '012345' a returns 012 but I am inputing strings of varying length and I cant just do the above notation. I need to split the string into groups of 3 in order to work. Any help would be much appreciated.
0
8638
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,...
0
9202
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9058
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8952
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7791
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4395
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...
0
4649
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2371
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2018
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.