Construct string with special characters

Asked

Viewed 2,237 times

4

I am building PDF’s, and I need to print a string with special characters. I am constructing the string as follows (using iTextSharp):

PdfPCell teste = new PdfPCell(new Phrase("<O meu texto> '\u20ac'", fontetexto));

Now what matters, my string is "<O meu texto> '\u20ac'", where the '\u20ac' present . Only I want to print a password point, as the following image shows: inserir a descrição da imagem aqui

I’m tired of searching lists with special characters for C# / ASP MVC and can’t find more of the characters like / , [, ] for example. How can I build the string with the special characters?

3 answers

3

Use:

PdfPCell teste = new PdfPCell(new Phrase("<O meu texto>" + ((char)0x20AC).ToString(), fontetexto));

Edit

The special character of this point you want is U+25CF, that is to say:

PdfPCell teste = new PdfPCell(new Phrase(((char)0x25CF).ToString() + " <O meu texto>", fontetexto));
  • My question is how to put a password point, the string I can build

  • @Cesarmiguel See the edited answer.

  • Where did you check the code? I could really use it :P

  • still without presenting

  • It depends on the font you are using, whether it displays the special character. Not all fonts have.

  • I already managed with the example of @2madera. Thanks anyway, although I could not seem valid answer!

Show 1 more comment

2


Maybe you should rewrite your code

Take a look at this class:

iTextSharp.text.ListItem

With her you have exactly what you want.

Take the example:

it.List list = new it.List(it.List.UNORDERED, 10f);
list.SetListSymbol("\u2022");
list.IndentationLeft = 30f;
list.Add(new it.ListItem("One"));
list.Add("Two");
list.Add("Three");
list.Add("Four");
list.Add("Five");

1

A String is nothing more than a Char Array:

char[] caracteres = {'0x20AC', '0x20AC', '0x20AC'};
string palavra = new string(caracteres);
  • My question is how to put a password point, the string I can build

Browser other questions tagged

You are not signed in. Login or sign up in order to post.