Click here to Skip to main content
16,005,141 members
Home / Discussions / C#
   

C#

 
QuestionPathTooLongException, Work around? [modified] Pin
James_12321-Sep-06 12:34
James_12321-Sep-06 12:34 
QuestionVS2005: Unsafe mode in web service? Pin
Goalie3521-Sep-06 11:24
Goalie3521-Sep-06 11:24 
QuestionString with escaped squences... Pin
e-laj21-Sep-06 11:22
e-laj21-Sep-06 11:22 
AnswerRe: String with escaped squences... Pin
Alaric_21-Sep-06 11:41
professionalAlaric_21-Sep-06 11:41 
AnswerRe: String with escaped squences... Pin
Christian Graus21-Sep-06 11:45
protectorChristian Graus21-Sep-06 11:45 
AnswerRe: String with escaped squences... Pin
Alaric_21-Sep-06 11:49
professionalAlaric_21-Sep-06 11:49 
AnswerRe: String with escaped squences... Pin
AndriyZZ21-Sep-06 12:15
AndriyZZ21-Sep-06 12:15 
AnswerMore Details: String with escaped sequences... Pin
e-laj21-Sep-06 13:03
e-laj21-Sep-06 13:03 
The idea is to enable the user to enter string constants that contains escape character - eaxactly as we do when we edit our source code in VS.
For example, the user maybe enter the following text in some text box:
"Hello\there\nand\there. But \\this is a backslash and not a tab chracater"
So, when i get this string, .NET framework treats these sequences as is and not as escape character - this is the expected behavior.
If you add a breakpoint at the right point and watch this user input in the debugger you will see:
"Hello\\there\\nand\\there. But \\\\this is a backslash and not a tab chracater"

However, i was wondering if there is a simple way, that is method supplied by the framework that do the job of escape character substitution as well as the reverse job.

So when i get this string i do the following:

string result = SubstituteEscapes(userInput);

...and the result will contains the same string after the "\t" replaced by the tab character and the "\n" replaced by the new line character and the
"\\" will be replaced by a single "\".

and the reverse way should be:

string original = SubstituteSpecialCharacters(result);

...and the the tab, new line and backslash characters will be replaced with the appropriate escape sequences.

It is possible to search and replace those escapes even by using regualr expressions. But does the framework has a built in method for that?

Why?
You may ask your self why i need these methods?
Well i use a ProperttyGrid and ask the user what should be the seperator string between fields in the log file.
Beacause pressing tab move the focus to the next property in the grid, and also because copying and pasting tab is BAD solution to this problem, i want to give the user the possiblity to enter escapes.

Thanks, again!




GeneralRe: More Details: String with escaped sequences... Pin
Christian Graus21-Sep-06 15:27
protectorChristian Graus21-Sep-06 15:27 
GeneralRe: More Details: String with escaped sequences... Pin
e-laj21-Sep-06 16:33
e-laj21-Sep-06 16:33 
AnswerOK: Here is a method to handle that... Pin
e-laj21-Sep-06 17:53
e-laj21-Sep-06 17:53 
AnswerRe: String with escaped squences... Pin
Rob Graham21-Sep-06 17:54
Rob Graham21-Sep-06 17:54 
GeneralRe: Finally found the method Pin
e-laj21-Sep-06 19:02
e-laj21-Sep-06 19:02 
Questionbinding a listbox Pin
heze21-Sep-06 11:18
heze21-Sep-06 11:18 
Answerself response Pin
heze21-Sep-06 11:36
heze21-Sep-06 11:36 
QuestionWhat is the best choice of this day for NATIVE Windows programming ? Pin
Nadia Monalisa21-Sep-06 11:03
Nadia Monalisa21-Sep-06 11:03 
AnswerRe: What is the best choice of this day for NATIVE Windows programming ? Pin
AndriyZZ21-Sep-06 12:22
AndriyZZ21-Sep-06 12:22 
AnswerRe: What is the best choice of this day for NATIVE Windows programming ? Pin
Christian Graus21-Sep-06 12:24
protectorChristian Graus21-Sep-06 12:24 
AnswerRe: What is the best choice of this day for NATIVE Windows programming ? Pin
Nader Elshehabi21-Sep-06 19:26
Nader Elshehabi21-Sep-06 19:26 
QuestionP2P file sharing and messaging Pin
asamay21-Sep-06 10:22
asamay21-Sep-06 10:22 
AnswerRe: P2P file sharing and messaging Pin
Ri Qen-Sin21-Sep-06 10:35
Ri Qen-Sin21-Sep-06 10:35 
AnswerRe: P2P file sharing and messaging Pin
Nader Elshehabi21-Sep-06 19:50
Nader Elshehabi21-Sep-06 19:50 
GeneralRe: P2P file sharing and messaging Pin
asamay22-Sep-06 9:30
asamay22-Sep-06 9:30 
QuestionTyped DataSets Pin
eggsovereasy21-Sep-06 10:05
eggsovereasy21-Sep-06 10:05 
QuestionProblem: Form Controls ghost when form moves [modified] Pin
Alaric_21-Sep-06 9:02
professionalAlaric_21-Sep-06 9:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.