Click here to Skip to main content
15,913,242 members
Home / Discussions / C#
   

C#

 
GeneralRe: Improve RichTextBox performance Pin
Luc Pattyn21-Jun-07 13:45
sitebuilderLuc Pattyn21-Jun-07 13:45 
QuestionFind ASCII value Pin
stone_sks21-Jun-07 7:48
stone_sks21-Jun-07 7:48 
AnswerRe: Find ASCII value Pin
PIEBALDconsult21-Jun-07 7:58
mvePIEBALDconsult21-Jun-07 7:58 
GeneralRe: Find ASCII value Pin
stone_sks21-Jun-07 8:07
stone_sks21-Jun-07 8:07 
GeneralRe: Find ASCII value Pin
PIEBALDconsult21-Jun-07 8:11
mvePIEBALDconsult21-Jun-07 8:11 
GeneralRe: Find ASCII value Pin
stone_sks21-Jun-07 8:23
stone_sks21-Jun-07 8:23 
GeneralRe: Find ASCII value Pin
PIEBALDconsult21-Jun-07 8:42
mvePIEBALDconsult21-Jun-07 8:42 
GeneralRe: Find ASCII value Pin
Luc Pattyn21-Jun-07 9:30
sitebuilderLuc Pattyn21-Jun-07 9:30 
PIEBALDconsult wrote:
Although, that test for < 32, is problematic


well, not really, I would suggest:

if (c < ' ') ...


There is one, very structured, alternative using an array, that serves as
a translator; it does not rely on any knowledge about ASCII values !

char[] translatation=new translation[128];
translatation[(int)'a']='a';
translatation[(int)'b']='b';
translatation[(int)'\t']=' ';
etc

then:
foreach (char cin in inputCollection) {
  char cout=0;
  if (cin<translation.Length) cout=translation[(int)cin];
  if (cout!=0) stringbuilder.Append(cout);
}


of course the initialization can be shortened by using a foreach loop as in

foreach (char c in "abcd....") translation[(int)c]=c;


Smile | :)


GeneralRe: Find ASCII value Pin
PIEBALDconsult21-Jun-07 10:32
mvePIEBALDconsult21-Jun-07 10:32 
GeneralRe: Find ASCII value Pin
stone_sks22-Jun-07 3:44
stone_sks22-Jun-07 3:44 
GeneralRe: Find ASCII value Pin
Luc Pattyn22-Jun-07 3:48
sitebuilderLuc Pattyn22-Jun-07 3:48 
GeneralRe: Find ASCII value Pin
stone_sks22-Jun-07 3:40
stone_sks22-Jun-07 3:40 
GeneralRe: Find ASCII value Pin
stone_sks21-Jun-07 8:16
stone_sks21-Jun-07 8:16 
AnswerRe: Find ASCII value Pin
Luc Pattyn21-Jun-07 8:05
sitebuilderLuc Pattyn21-Jun-07 8:05 
QuestionDGV Value Translation Pin
netizenk21-Jun-07 7:48
professionalnetizenk21-Jun-07 7:48 
QuestionRemote file editing using Domain admin credentials Pin
Mike Donner21-Jun-07 7:21
Mike Donner21-Jun-07 7:21 
Questiona project Pin
tarun suneja21-Jun-07 7:14
tarun suneja21-Jun-07 7:14 
AnswerRe: a project Pin
Luc Pattyn21-Jun-07 7:17
sitebuilderLuc Pattyn21-Jun-07 7:17 
AnswerRe: a project Pin
Martin#21-Jun-07 7:45
Martin#21-Jun-07 7:45 
Questionhow to determine that .NetFrameWork has been installed or not ? Pin
hdv21221-Jun-07 6:40
hdv21221-Jun-07 6:40 
AnswerRe: how to determine that .NetFrameWork has been installed or not ? Pin
Luc Pattyn21-Jun-07 6:48
sitebuilderLuc Pattyn21-Jun-07 6:48 
AnswerRe: how to determine that .NetFrameWork has been installed or not ? Pin
mav.northwind21-Jun-07 9:07
mav.northwind21-Jun-07 9:07 
AnswerRe: how to determine that .NetFrameWork has been installed or not ? Pin
Stu Richardson21-Jun-07 22:29
Stu Richardson21-Jun-07 22:29 
QuestionAccessing classes/functions in .dll added as reference Pin
lechium12121-Jun-07 6:27
lechium12121-Jun-07 6:27 
AnswerRe: Accessing classes/functions in .dll added as reference Pin
Luc Pattyn21-Jun-07 6:38
sitebuilderLuc Pattyn21-Jun-07 6:38 

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.