Solved

escape sequence in c#

Posted on 2006-07-11
4
1,163 Views
Last Modified: 2012-06-21
I came asross code for sorting datagrids with arrow images
 http://aspnet.4guysfromrolla.com/demos/dgExample37.aspx

is there a better way to achive this using c# (can't stand vb code!!)

if not, then

I would like to translate this to c# code.
particularly the escape sequence:

Regex.Replace(c.HeaderText, "\s<.*>", String.Empty)

ie how do you write this  "\s<.*>"  in c#, and what does \s mean?

Thanks
Ugo


0
Comment
Question by:ugougbor
[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
4 Comments
 
LVL 18

Accepted Solution

by:
Ravi Singh earned 125 total points
ID: 17083772
\s is a regex shorthand for empty space.
. is the symbol that represents any character
* means zero or more
< and > match themselves

You can translate that statement to the following in C#:

Regex.Replace(c.HeaderText, @"\s<.*>", string.Empty)
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17083810
Or:

    Regex.Replace(c.HeaderText, "\\s<.*>", string.Empty);
0
 
LVL 18

Expert Comment

by:Ravi Singh
ID: 17083812
Sorry, \s matches any white-space character so that includes new line, carriage returns, tabs...
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 17083878
Just one clarification to Zephyr__ answer the Regex meta character \s stands for any single white space character such as space, tab, newline, carrage return, line feed, and some others.
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

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…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

738 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