Click here to Skip to main content
15,904,416 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need c# code to replace a Hebrew letter with the asterisk letter
without distortion of the Hebrew text.

The code that I tried distort the Hebrew text.

for example

for this text אהרוני if I replace the Hebrew letter י
I get this result אהרונ*


Thank you.

What I have tried:

private void replaceBTN_Click(object sender, EventArgs e)
{
  if(replaceTB.Text.Length > 1) return;
  string tmpstr = InputTB.Text;
  InputTB.Text = tmpstr.Replace(replaceTB.Text[0], '*');
}
Posted
Updated 8-Mar-21 10:02am
Comments
[no name] 8-Mar-21 14:32pm    
"Remove"; then concatenate (+) the '*' to the front or the end - whatever works.
Member 13569650 8-Mar-21 14:51pm    
If the * replace a heb letter that is
in the middle of a heb word then
that's go ok.

but if the * replace a heb letter that is in the start or the end of

the heb word the result is distorted.

so your suggestion not clear.

also if replace don't succeed why you think concatenation will.

thank you very much

1 solution

This all depends on what you mean by "distorted". I imagine it's about how the string is being rendered on screen, but you have to describe what you mean instead of people assuming what you mean.
 
Share this answer
 
Comments
Member 13569650 8-Mar-21 18:06pm    
before אהרוני
after אהרונ*

I want that the asterisk to be
in the replacement location.

Thanks
Dave Kreskowiak 8-Mar-21 20:15pm    
That means nothing. What is "location"? Are you talking about what is rendered on screen?
Member 13569650 9-Mar-21 0:43am    
sorry for the upset.

If you look again in the what's I tried.

you will see that the user input is
in a textbox.

and what I see in the rendered screen
is the same that I see in the textbox
buffer when in debugging.

If still I am not clear tell me
and I'll build a small app to illustrate.

Thank you very much.
Dave Kreskowiak 9-Mar-21 12:32pm    
The only way to keep the text in the TextBox from shifting over at all is to use a monospaced font. Variable spaced fonts have characters, including the asterisk, of different widths.
Member 13569650 9-Mar-21 15:15pm    
I changed Font to Courier new
which is monospaced and same result.

Anyway I'm thank you for your efforts

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900