Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: Parsing
i got this sentence such as (p1 and p2),i want to keep Structure , i only want to replace p1,p2 to my own variable and change it this sentence for example (v1 and v2),and my Language is
thanks a lot
Posted 10-May-12 4:00am
Edited 10-May-12 6:17am
B Birajdar at 10-May-12 9:07am
not clear....
Ed Nutting at 10-May-12 9:08am
This is very unclear. Please improve your question - at the moment I have no clue what you are trying to do. What sort of sentence? An English sentence or is this some form of sentence you've made up?
Sandeep Mewara at 10-May-12 11:10am
This is not a well framed question! We cannot work out what you are trying to do/ask from the post. Please elaborate and be specific.
Use the "Improve question" link to edit your question and provide better information.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Use strtok() and sprintf() if C++, or String.Split() and String.Format() if C# or VB.NET.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

As you haven't stated what your requirements really are, given the problem description you've shown you could simply replace the comma with and in a straightforward text replacement. For instance (and I'm assuming C# here since you haven't even said which language:
string text = "V1,V2";
Console.WriteLine(string.Replace(",", " and ");
You really need to say what your requirements really are before you'll get much better as an answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Advertise | Privacy | Mobile
Web01 | 2.8.150326.1 | Last Updated 10 May 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100