?
Solved

manipulation of a long string

Posted on 2005-03-16
2
Medium Priority
?
284 Views
Last Modified: 2010-04-16
I get a string from a recordset, with is delemitered by the | character for
the different values.

The string looks like this:   Peter|Pan|Donald|Duck

Now I would like to each value seperately. For example LblFax.Text should have the value "Donald".

strDetails = rs.GetString(ADODB.StringFormatEnum.adClipString
,1,"|",",",null);
LblFax.Text = getTheDetails(0);

I wrote the getTheDetails function to get the strings.

public string getTheDetails(int intIndex)
{
int intEnd = strDetails.IndexOf("|", intIndex, strCurrent.Length);
strTmpDet = strDetails.Substring(intEnd);
return strTmpDet;
}

It doesn't work properly. Where do I set from which delemiter to begin. Or
is this not possible at all?

Thanks for your help.

Cheers

Chris
0
Comment
Question by:ccoe1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
melodiesoflife earned 400 total points
ID: 13553335
You can get sub string easier:

string[] a_str = strDetails.Slpit("|");

public string getTheDetails(int intIndex)
{
     return a_str[intIndex];
}
0
 

Author Comment

by:ccoe1
ID: 13553520
Just change the

string[] a_str = strDetails.Slpit("|"); to this and it works perfect

a_str = strDetails.Split('|');
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question