Orc() and Chr() in java.

Hmm, i'm feeling stupid to ask this..

But.. I used to code in delphi, and in there i used the functions Orc and Chr.

Now in java i have to do the same again, but i dont have a clue how.. Some forum searches give suggestions that don't seem to work?

Anyway, what i'm trying to do.

is like this: first for ma string..
String s= Characterfromint(1) + Characterfromint(x) + "some string"

And then when i receive the string via tcp i need to get the values again..
I already figured i could do something like:
int messageType=s.charAt(0);

So basicly i need something that can convert an integer to an Ascii Char so i can put it in a string.

Comments

  • Allright, tried a few things and finally found something.. easy actually

    i just cyould do the following

    String s=(char)ascii;

    So in order to make my string i might do something like.

    String s=(new StringBuffer()).append((char)1).append("this is a test.").toString;

    Kind regards,
    Ivo

    This thread may be closed.


    : Hmm, i'm feeling stupid to ask this..
    :
    : But.. I used to code in delphi, and in there i used the functions Orc and Chr.
    :
    : Now in java i have to do the same again, but i dont have a clue how.. Some forum searches give suggestions that don't seem to work?
    :
    : Anyway, what i'm trying to do.
    :
    : is like this: first for ma string..
    : String s= Characterfromint(1) + Characterfromint(x) + "some string"
    :
    : And then when i receive the string via tcp i need to get the values again..
    : I already figured i could do something like:
    : int messageType=s.charAt(0);
    :
    : So basicly i need something that can convert an integer to an Ascii Char so i can put it in a string.
    :
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion