Search:
Namespaces
Discussions
.NET v1.1
Feedback
Not having word more than 50 characters...
Messages
Related Types
This message was discovered on
microsoft.public.dotnet.framework.aspnet
.
Post a new message to this list...
Amith Singh
Hello All,
I am using .Net Framework 1.1.
Using Regular Expressions I would like to split a word(inserting a blank
space) in a string if the word is more than N(say 50) characters. I can do
the same using string manipulations. I am just curious using regular
expressions it should be fast and less number of statements.
Thanks,
Amith
Reply to this message...
Kevin Spencer
Regular Expressions is not particularly useful in this situation. It's
really a matter of building a new string by using Substring on the original,
and concatenating the portions together.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"Amith Singh" <
Click here to reveal e-mail address
> wrote in message
news:
Click here to reveal e-mail address
...
[Original message clipped]
Reply to this message...
Karl
Kevin,
Why would you say regular expressions aren't particularly useful? I think
part of the problem is what's being done isn't well explained. This is the
3rd time Amith has asked and each time we get slightly more information. I
agree with you that if you have a single word in a string string x = "blah"
then substring makes sense. But I'm ASSuming that we are talking about
large text fields...in which case I think regular expressions are the right
way (maybe not the only one) to go...
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Kevin Spencer" <
Click here to reveal e-mail address
> wrote in message
news:
Click here to reveal e-mail address
...
[Original message clipped]
Reply to this message...
Kevin Spencer
> Why would you say regular expressions aren't particularly useful?
I did say "in this situation." I use Regular Expressions "regularly."
However, if you think using Regular Expressions in this case is a good idea,
go ahead and post your solution. :)
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:
Click here to reveal e-mail address
...
[Original message clipped]
Reply to this message...
Karl
I did in one of the previous threads Amith started asking the same question
:P
but here it is again:
Regex
r = new
Regex
(@"(?<string>\S{50})",
RegexOptions
.Compiled
|RegexOptions.Multiline |
RegexOptions
.ExplicitCapture);
string newString = r.Replace(YOURSTRINGHERE, "${string} ");
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Kevin Spencer" <
Click here to reveal e-mail address
> wrote in message
news:e5ch5$
Click here to reveal e-mail address
...
[Original message clipped]
Reply to this message...
System.Text.RegularExpressions.Regex
System.Text.RegularExpressions.RegexOptions
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com