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

Searching string in between characters?

13
Hi everyone,

I've had good luck with the questions I've posted on here so I'm going to try again.

Let's say you had a string that looked like this:

Some text | Some text | Text to extract | Some text
How would you extract everything between the 2nd and 3rd |? I know how to find the first or last occurance of a character but I'm not sure how to do this.

Thanks for your help,
Paul
Oct 9 '07 #1
2 1180
Shashi Sadasivan
1,435 Expert 1GB
How does this look?

Expand|Select|Wrap|Line Numbers
  1.  string str = "Some text | Some text | Text to extract | Some text";
  2. string[] splits = str.Split('|');
  3. foreach (string s in splits)
  4. {
  5.    Console.WriteLine(s);
  6. }
Oct 9 '07 #2
Paul73
13
Hi Shashi,

That's just what I was looking for. Thank you. This is something I'm sure to use many times.

Paul
Oct 10 '07 #3

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

Similar topics

18
by: jblazi | last post by:
I should like to search certain characters in a string and when they are found, I want to replace other characters in other strings that are at the same position (for a very simply mastermind game)...
4
by: tgiles | last post by:
Hi, all. Another bewildered newbie struggling with Python goodness. This time it's searching strings. The goal is to search a string for a value. The string is a variable I assigned the name...
8
by: Dirk Deimeke | last post by:
Hello, we have a database with one column CHAR(10), which contains numeric data (10 digits). (That was not my idea). Now, I have to find out all rows, which do not have numeric data in this...
3
by: Stewart Allen | last post by:
Hi there I'm trying to find part serial numbers between 2 numbers. The user selects a part number from a combo box and then enters a range of serial numbers into 2 text boxes and the resulting...
3
by: Paul H | last post by:
I have a text file that contains the following: ******************** __StartCustomerID_41 Name: Fred Smith Address: 57 Pew Road Croydon
7
by: herrcho | last post by:
i'm in the course of learning C, and found these two words "string, string literal" confusing me.. I'd like to know the difference between them.. Thank you
35
by: Cor | last post by:
Hallo, I have promised Jay B yesterday to do some tests. The subject was a string evaluation that Jon had send in. Jay B was in doubt what was better because there was a discussion in the C#...
8
by: abhi147 | last post by:
Hi all , I need to convert a 32 bit string containing hex digits like "76d408cedd600bb578bc0256a751cea2" into it's corresponding 16bit ascii value like "vÎÝ` µx¼V§Q΢" . Now the presence of...
1
by: redalpha | last post by:
hi all, I want to search a string between 2 characters for ex. 'bc' between A and D. So plz help me. regards
1
by: remya1000 | last post by:
I’m using VB.net 2003 application program. I am trying to do a select statement whereby I'm searching between 2 datetime values that are being stored as datetime. records are stored inside...
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...
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
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
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
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...

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.