Solved

escape sequence in c#

Posted on 2006-07-11
4
1,166 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
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.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses

627 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