Convert Continue Ascii to String Java
hszforu -3 Junior Poster in Training
Recommended Answers
I don't know whether this is an good way of coding but i tried converting String to binary and i don't think Java uses ASCII it uses UNICODE CODE POINT.
Anyways what you can do is first convert your String to byte array by using the getBytes() method and then …
Jump to Post
Are you asking something like how to convert this String: "A" to this: "1000001"
Jump to Post
All 7 Replies
NormR1 563 Posting Sage Team Colleague
hszforu -3 Junior Poster in Training
Are you asking something like how to convert this String: "A" to this: "1000001"
no i want to convert the string for eg. "hello world" into binary formati.e in 1 and 0's form.
NormR1 563 Posting Sage Team Colleague
Sorry, can you explain what you want that is different than what I asked. Other than my example's String was 1 letter vs 11 in yours.
What do you mean by "binary format"? I assumed you wanted a String of 0s and 1s.
Can you give a short example of what you want?
hszforu -3 Junior Poster in Training
Sorry, can you explain what you want that is different than what I asked. Other than my example's String was 1 letter vs 11 in yours.
What do you mean by "binary format"? I assumed you wanted a String of 0s and 1s.
Can you give a short example of what you want?
i mean:
string= more than 1 charcters eg."hi what are you doing"
binary format= string of 0 nd 1 eg. 101010011
Ezzaral commented: That is exactly what NormR1 just posted. -3
NormR1 563 Posting Sage Team Colleague
Then my example shows what you want.
Soni's post gives you a way to do that.
Another way would be to use the String class's methods to get each character and then use the toBinaryString method to create the String. You'd need to pad them to 8 characters.
hszforu -3 Junior Poster in Training
Then my example shows what you want.
Soni's post gives you a way to do that.Another way would be to use the String class's methods to get each character and then use the toBinaryString method to create the String. You'd need to pad them to 8 characters.
ok i will try and see if i can get it to work.
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.
Source: https://www.daniweb.com/programming/software-development/threads/383754/how-to-convert-ascii-string-to-binary
0 Response to "Convert Continue Ascii to String Java"
Post a Comment