• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 196
  • Last Modified:

Replace some characters in string

Hi.

I have working POS application which prints receipt directly to POS printer using ESCAPE codes to format receipt.
Now, some printers doesn't support my local language code and instead some letters i am receving garbage on print.

For Example: "This is sa&es Da*t$"...

The question is, how can i search whole string and replace certain characters (&,*,$) with (l,e,s).

I know of String.Replace but is there way to do this in one pass of the string?

Thank you.
0
Grogel
Asked:
Grogel
1 Solution
 
sachinpatil10dCommented:
This works

"This is sa&es Da*t$".Replace("&","l").Replace("*","e").Replace("$","s")

Open in new window

0
 
Paul MacDonaldDirector, Information SystemsCommented:
Not unless you nest the Replaces...and that's technically not one pass.
0
 
CodeCruiserCommented:
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now