CodeVerge.Net Beta
Login Idy
Register Password
  Forgot?
Explore    Item Entry    Profile   
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML





Zone: > newsgroup > asp.net forum > visual_studio.visual_web_developer_2005_express Tags:
Item Type: NewsGroup Date Entered: 7/11/2007 7:43:38 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 5 Views: 9 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
6 Items, 1 Pages 1 |< << Go >> >|
Suryansu
Asp.Net User
Getting subsrtrings from a string which contains special characters like ?7/11/2007 7:43:38 AM

0/0

hi

I have a string which contains some even no. of special characters    '?'

for example

 str="string contains ?special? character but how?to?  asjdjfjkdfjkd?check?"

i want to get substrings starts with ? and ends with ?

So in the above example my output should be

1.special

2,to

3.check

 

ca8msm
Asp.Net User
Re: Getting subsrtrings from a string which contains special characters like ?7/11/2007 10:16:13 AM

0/0

You can use a Regular Expression (System.Text.RegularExpressions.Regex) to extract this information. Have a look at the Regular Expression Library to get you started.


Mark,
http://aspnetlibrary.com
http://mdssolutions.co.uk - Delivering professional ASP.NET solutions
http://weblogs.asp.net/marksmith


Please remember to click "Mark as Answer" on this post if it helped you.
sanjayd
Asp.Net User
Re: Getting subsrtrings from a string which contains special characters like ?7/11/2007 10:26:02 AM

0/0

 

                                                string s="asjdjfjkdfjkd?check?";
			string[]value=(s.Split('?'));
			string monthaname=value[1];
			TextBox1.Text=value[1];
                                                 string myValue=value[1];

                    you can get the value in a Text box or you can get it to a specified variable
 
If this will help you do not forget to "Mark as Answer"

Sanjay D.
ca8msm
Asp.Net User
Re: Getting subsrtrings from a string which contains special characters like ?7/11/2007 10:44:33 AM

0/0

sanjayd:

 

                                                string s="asjdjfjkdfjkd?check?";
			string[]value=(s.Split('?'));
			string monthaname=value[1];
			TextBox1.Text=value[1];
                                                 string myValue=value[1];

                    you can get the value in a Text box or you can get it to a specified variable

 

 

The Split function won't work in this case - have a look at the user's expected output to see why. 


Mark,
http://aspnetlibrary.com
http://mdssolutions.co.uk - Delivering professional ASP.NET solutions
http://weblogs.asp.net/marksmith


Please remember to click "Mark as Answer" on this post if it helped you.
sanjayd
Asp.Net User
Re: Getting subsrtrings from a string which contains special characters like ?7/11/2007 10:52:44 AM

0/0

 

you post is confusing

str="string contains ?special? character but how?to?  asjdjfjkdfjkd?check?"

why ?

how can computer know which one is your starting and which one is your ending ? character.

 

 


If this will help you do not forget to "Mark as Answer"

Sanjay D.
ca8msm
Asp.Net User
Re: Getting subsrtrings from a string which contains special characters like ?7/11/2007 11:15:37 AM

0/0

sanjayd:

you post is confusing

 

Why is it confusing? The string contains characters that the user wants to use a delimiters. 

sanjayd:

how can computer know which one is your starting and which one is your ending ? character.

That's what a Regular Expression will be able to determine. It will find once instance of a character and use that as the start. When it finds the next instance of it it will use it as the end character and return the value in between. It can do this for every group of characters in a specified string.


Mark,
http://aspnetlibrary.com
http://mdssolutions.co.uk - Delivering professional ASP.NET solutions
http://weblogs.asp.net/marksmith


Please remember to click "Mark as Answer" on this post if it helped you.
6 Items, 1 Pages 1 |< << Go >> >|



Search This Site:


Meet Our Sponsors:



Other Resources:

Getting subsrtrings from a string which contains special characters ... Getting subsrtrings from a string which contains special characters like ? ... Getting subsrtrings from a string which contains special characters like ? 7/11 ...
Getting subsrtrings from a string which contains special characters ... Getting subsrtrings from a string which contains special characters like ? ... Getting subsrtrings from a string which contains special characters like ? 7/11 ...
Cannot view iprint properties - novell.support.groupwise.6x.web-access ... Cannot view iprint properties, > ROOT > NEWSGROUP > Novell Forums > novell. ... getting subsrtrings from a string which contains special characters like ? ...
Getting subsrtrings from a string which contains special characters ... Getting subsrtrings from a string which contains special characters like ? 07-11-2007, 3:43 AM ... Getting subsrtrings from a string which contains special ...
Visual Web Developer 2005 Express How to get the properties box to display properties while in ... Getting subsrtrings from a string which contains special characters like ? 2007-07-11 07:43:38 ...


 
All Times Are GMT