Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a string
105 102 109 109 112 120 112 115 109 101 

it is a ASCII code (means hello world in ascii) and I want to decode it in c#.
I know how to do it with bytes, but I don't know how to do it with strings.
There is a space between every character.
What can I do ?
Thanks in advance

What I have tried:

tried to convert the string into a byte array.
Posted
Updated 30-Jan-21 17:30pm
Comments
PIEBALDconsult 31-Jan-21 20:19pm    
You need to learn to decompose a complex task into several simpler sub-tasks.

1 solution

It's nothing but splitting the string into an array of strings, then iterating over the array and converting each of those small strings into an integer, then a character.

Look at the String.Split()[^] method.

By the way, those values will not output "helloworld". They are all off by 1.
 
Share this answer
 
Comments
Arda Güler 31-Jan-21 0:00am    
Thanks :D

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