Home > Uncategorized > c# string replace escape characters

c# string replace escape characters


Input argumenets
#to=test@gmail.com #subject=”Welcome to” #server=mail.gmail.com #port=8080 #from=from@gmail.com
#to=”test@gmail.com” #subject=”Welcome” #server=”mail.gmail.com” #port=”8080″ #from=”from@gmail.com”
#to=\”test@gmail.com\” #subject=\”Welcome\” #server=\”mail.gmail.com\” #port=\”8080\” #from=\”from@gmail.com\”

Expected input string to application.
#to=\”test@gmail.com\” #subject=\”Welcome\” #server=\”mail.gmail.com\” #port=\”8080\” #from=\”from@gmail.com\”

Application will get Input argumenets in any format of give 3 type, but business will work for only one type of format, so we have to manipulate rest of the 2 types to 3rd type.

Solution:
I am going to write one exe, to manipulate inout args.
Open Visual studio
Create new console project: StringEscapeCharacters
Open: Program.cs file

Please find my code…

Now i have to pass arguments to my exe, i can to multiple ways..
1st way: Open solution explorer, right click on project.
Click on: Properties
Click on: Debug
Under Start Options:
Command line arguments:
Ex:
#to=test@gmail.com #subject=”Welcome to exe” #server=mail.gmail.com #port=8080 #from=from@gmail.com

You will get out put as in the log file:C:\Temp\mylog.log
#to=”test@gmail.com” #subject=”Welcome to exe” #server=”mail.gmail.com” #port=”8080″ #from=”from@gmail.com”

2nd way passing args:
Build the application.
now go to bin/debug folder,
you will see: StringEscapeCharacters.exe
execute this exe from cmd and pass args.
ex: StringEscapeCharacters.exe #to=test@gmail.com #subject=”Welcome to exe” #server=mail.gmail.com #port=8080 #from=from@gmail.com

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: