473,386 Members | 1,674 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,386 software developers and data experts.

Splitting Strings

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

10/8/2007 5:03:06 PM thakurab *************RECIVED 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

*************RECIVED 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 1287
nateraaaa
663 Expert 512MB
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 Expert 1GB
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
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 8TB
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
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...
5
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
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...
9
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
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!)...
2
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...
20
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...
2
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...
4
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...
4
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.