Solved

escape sequence in c#

Posted on 2006-07-11
4
1,156 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
  • 2
4 Comments
 
LVL 18

Accepted Solution

by:
Ravi Singh earned 125 total points
Comment Utility
\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
Comment Utility
Or:

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

Expert Comment

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

Expert Comment

by:Fernando Soto
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now