Converting a character to ASCII

Hi ,
I have a string and I should be converting it into to ASCII character.
Is there a method in java where we can convert a character(something like "a") to a ASCII character("65").
Thanks,
Anna

Hello Abikkina,
This is how you can do...
String s ="Example"
int [] ascii = new int[s.length()];
for(int i =0; i<s.length(); i++)
ascii[i] = (int)s.charAt(i);
for(int i = 0; i<ascii.length; i++)
System.out.println("Ascii output"+ascii);
Just cast the character into int then you will get the ASCII value.

Similar Messages

  • How to convert character to ascii

    Hi i need to check the value of the character less than space so need to make calc based on ASCII values
    can some one tell me how can i convert chars & numbers to ASCII

    Hi,
    Please check this code:
    Below logic is for convert from character to ascii value :
    report test.
    *going from A to 65
    data : c value 'A'.
    field-symbols : <n> type x.
    data : rn type i.
    assign c to <n> casting.
    move <n> to rn.
    write rn.
    Below logic is for convert from ascii tocharacter value :
    *going from 66 to B
    data : i type i value 66.
    data : x type x.
    field-symbols : <fc> type c.
    move i to x.
    assign x to <fc> casting type c.
    move <fc> to c.
    write c.
    May it gives you some idea.
    I hope it helps you.
    Thanks.
    Deepak Sharma.

  • Converting an english character to ASCII without files

    I am working on an encryption project for school and can't find any code that will convert a single character to the ascii counterpart. There is the:
    String p = System.getProperty("line.separator");
    System.out.println(p);
    But that only converts to the primary code of the computer used. There is also code that will convert like this, but writes to a file. I only need it to output the counterpart in ascii within the program, not a file. I know this is probably simple but I cannot find how to do so. I could build a class that will do it, but I am sure it's already out there. I just need to know the syntax. It could work like this:
    convert(R); //will produce ASCII code for character 'R'
    outputs: 82
    If anyone can help email me or post a reply. Thanks for your time.

    ok, someone correct me if I'm wrong, but - isn't there a direct map between the int value of the char and the char value of the int? That is, when I run this program...
    public class CharConvert {
        public static void main(String[] args) {
            char charToConvert = '\uFEFC';
            int codeToConvert = 65276;
            System.out.println("Char converts to: " + (int)charToConvert);
            System.out.println("Code converts to: " + (char)codeToConvert);
    }I get the output
    $ java CharConvert
    Char converts to: 65276
    Code converts to: ?('cause my shell can't seem to spit out that arabic symbol tha tis unicode FEFC). So, can't we just cast to convert here? Or am I missing something?
    What I'm saying is, can't RadiantProgrammer just say
    char rChar = (char)rCode;?
    Lee

  • Convert from char to ASCII code

    anyone can advice me on this program why the conversion cannot be done? Thank in advance.
    String charInput = JOptionPane.showInputDialog (null, "Enter a character", "Finding ASCII code", JOptionPane.QUESTION_MESSAGE) ;
    answer = Integer.parseInt (charInput) ;

    Try this code out:
    import javax.swing.JOptionPane;
    public class Crap {
        public static void main (String[] args) {
            String charInput =
                    JOptionPane.showInputDialog (null,
                    "Enter a character", "Finding ASCII code",
                    JOptionPane.QUESTION_MESSAGE) ;
            JOptionPane.showMessageDialog (null, charInput, "Collected Data",
                    JOptionPane.INFORMATION_MESSAGE );
    //        answer = Integer.parseInt (charInput) ; //<-- What datatype?
            String answer = "You never declare the data type for you answer.\n" +
                    "JOptionPane returns a string of what the user enters.\n" +
                    "The first?  The last? Some other position?\n" +
                    "A String != a character.\n" +
                    "Which character of the string do you want to convert?\n" +
                    "You need to do a lot more work on this problem.";
            JOptionPane.showMessageDialog (null, answer,
                    "The Java Compiler hates your code because...",
                    JOptionPane.OK_OPTION, null);
    }http://leepoint.net/notes-java/GUI/containers/20dialogs/10joptionpane.html
    Cheers !
    JJ

  • Character Mode ASCII Distribution

    Hi,
    I have a distribution report, Character Mode, ASCII format, that I can run without any problems from Report Builder, but the output is wrapping after what appears to be 80 characters, how do I make this wider? I've set my Main Section -> Character Mode -> Report Width to 190 without any change.
    Thanks,
    Lena Lafond

    In the Layout Model, Header Section or Main Section or Trailer Section's properties according to which section you are referring to.
    I think this is new with Reports 6i.

  • Why summaries are converted to character when exported to excel??

    Hi,
    When i export my discoverer workbooks to excel, all of my summaries are converted to character type and excel gives error messages for each cell and asks to convert them back to numbers. Its not possible to do so because Discoverer plus is a client tool and no client would prefer rework. They'll simply say why to use Discoverer then?
    Any suggestions appreciated.
    Thanks.

    Using Acrobat DC and the acrobat arrow tool. By right clicking on an image a submenu pops up. One of the items in that list is "Edit Image".  Ordinarily or historically this would then open the image in Photoshop as a temp file. Edits could be made and saved and the image would be auto updated back into the PDF.  In DC when selecting edit image, the document goes into a edit mode and the entire file gets converted into RGB color.  From here one could again right click on the same image and get the option to edit using another program, (like photoshop).  When returning back to document mode, the RGB conversion remains.
    I determine the files are converted to RGB by using the inspector tool in Acrobat as well as looking at the colorspace in Photoshop
    I determined the files were CMYK by building them that way and again verifying using Pitstop inspector.
    Following screen grabs show image before / and after selecting "Edit Image"

  • Approach to converting database character set from Western European to Unicode

    Hi All,
    EBS:12.2.4 upgraded
    O/S: Red Hat Linux
    I am looking for the below information. If anyone could help provide would be great!
    INFORMATION NEEDED: Approach to converting database character set from Western European to Unicode for source systems with large data exceptions
    DETAIL: We are looking to convert Oracle EBS database character set from Western European to Unicode to support Kanji characters. Our scan results show
    both “lossy (110K approx.)” and “truncation (26K approx.)” exceptions in the database which needs to be fixed before the database is converted to Unicode.
    Oracle Support has suggested to fix all open and closed transactions in the source Production instance using forms and scripts.
    We’re looking for information/creative approaches  who have performed similar exercises without having to manipulate data in the source instance.
    Any help in this regard would be greatly appreciated!
    Thanks for yourn time!
    Regards,

    There are two aspects here:
    1. Why do you have such large number of lossy characters? Is this data coming from some very old eBS release, i.e. from before the times of the Java applet interface to Oracle Forms?  Have you analyzed the nature of this lossy data?
    2. There is no easy way around truncation issues as you cannot modify eBS metadata (make columns wider). You must shorten or remove the data manually through the documented eBS interfaces. eBS does not support direct manipulation of data in the database due to complex consistency rules enforced by the application itself (e.g. forms).
    Thanks,
    Sergiusz

  • It's possible to convert 'WE8MSWIN1252' character to chinese character set?

    Hi All,
    Is anyone know how to convert "WE8MSWIN1252" character to chinese character set in order to display chinese word in oracle apex?
    My problem is i can't display chinese character set in oracle apex. The chinese field is showed like °×ѪÇò¼ÆÊý. I'm using WE8MSWIN1252 database character set.
    I'm wondering it's possible to show character word?
    I'm appreciating if anyone have a good solution to share with me.
    Thanks a lot in advance!
    Edited by: Apex Junior on Jul 16, 2010 2:18 PM

    WE8 is a Western European character set. If you wish to store and access a globalized multibyte character set you must have a database that supports it: You don't have one at the moment.
    Given this is Apex I'd suggest you read the docs and reinstall.
    Alternatively you could try CSSCAN and CSALTER and perhaps you can make the change but be very careful and have a good backup before you try.
    http://www.morganslibrary.org/reference/character_sets.html

  • Problem : "You cannot convert the character set"..Any suggestions?

    Hi All,
    I have this character inside my internal table, KOÇTA&#350; YAPI MARK.T&#304;C A.&#350;. and it created a short dump on the program and it says "You cannot convert the character set". But this customer is already maintained inside the table KNA1..
    The code is like this one:
    REPLACE ALL OCCURRENCES OF '€' IN linebuffer WITH 'EUR'.
    TRANSFER linebuffer TO filename. "LENGTH bytes_to_transfer.
    the LINEBUFFER here is an internal table.
    I think conversion is the key here. Do anyone knows how to convert this thing? Or is it the Unicode system?  Could someone please help me to my problem?
    Thanks so much guys!
    Regards,
    Mackoy

    Hi,
    What i feel here is you are trying to pass  totla internal table at once.Internal table may have more than one record.Filename may string which can contain one row.
    So instead of that put the internal table into LOOP.
    DATA : v_string(200).
    LOOP AT  LINEBUFFER.
    Here your internal table may have non char data type.That is the
    main problem.
      Note : while concatenating all non char fields of LINEBUFFER
               should move to first to temporary char field and conatenate it
    CONCATENATE  LINEBUFFER-field1 LINEBUFFER-field2
      INTO  v_string.
    ENDLOOP.

  • Convertion from CHAR to ASCII

    Hello,
    Please tell me how we can change a character to ASCII foormat.
    Points will definitltely be given to the useful answers.
    thanks.

    Hi,
    Check following link:
    [http://www.sap-img.com/abap/how-can-i-get-ascii-value-of-any-letter.htm]
    or
    Check function module:
    SCP_TRANSLATE_CHARS
    Regards,
    Harsh.

  • Converting EBCIDC file to ASCII with OWB

    Hi
    How can you convert EBCIDC files into ASCII with OWB 10gR2?
    Thanks!

    See the paper
    http://www.oracle.com/technology/products/warehouse/pdf/COBOL%20Data%20Integration%20with%20OWB10gR2.pdf
    for details. I thought there was also the demo MDL for it, but the paper has lots of useful info.
    Cheers
    David

  • Convert Character to ASCII Number

    Hello.
    I would greatly apprectiate if someone could tell me how to convert a Number or Character to its ASCII decimal representation. For example if I have the number 9 I would like to save its ASCII decimal number 39 instead.
    Thank YOU!!

    By the way, getNumericValue doesn't return the unicode value of the character but the numeric value - for instance it returns the int 9 for the character '9' and the int 15 for the character 'F' (since 15 is F in hex).

  • Character to ASCII

    I want to convert a string(each character in a string) into ASCII in hex.
    for example :
    if the string is "Begin", i need to convert it into 042h,065h,067h,069h,06Eh
    Can anyone let me know how to do this in Java?

    Do you want your result to be a string, containing the hex representations of each character code?
    Check out Integer's toHexString.

  • Convert PDF File to ASCII / Text File

    Hello,
    I have a PDF File that was created from a Spools (Output of Smart Form to begin with and run in background) using the SAP Function module - CONVERT_OTFSPOOLJOB_2_PDF and I have the pdf file archived.
    Now, I need to do Reverse process. The original Spool is gone, and I need to extract some data from the pdf file - say, for example:
    I need to extract A/c numbers where the Label is "Account No:" followed by value of the Account No.
    I opened the pdf file in Binary mode, stored into an internal table of type Hex and then LOOP ed through this table.
    Moved the Hex data to a long enough data field of Type C to use "CS" operator in an IF Statement to look for the String "4163636F756E74204E6F3A" which is Hex representation of  'Account No:' (without the single quotes).
    I can see 'Account No:' in the PDF File but my IF Statement with CS fails. I even tried to find the Zip Code using CS Statement - it fails too.
    Some sample codes that I used are as follows:
      LV_TAG_1_C = '4163636F756E74204E6F3A'.
    refresh: T_DATA_FILE_C.
      LOOP AT T_DATA_FILE_X.
        ASSIGN T_DATA_FILE_C-DATA TO <FS_C>.
        T_DATA_FILE_C-DATA     = T_DATA_FILE_X-DATA.
        IF T_DATA_FILE_C-DATA CS LV_TAG_1_C.
    * The Above IF Statement NEVER became TRUE - even though I can see the "Account No:"
          LV_VAL_1_C = <FS_C>+SY-FDPOS(6).
          APPEND T_DATA_FILE_C.
        ENDIF.
      ENDLOOP.
    Outside LOOP, T_DATA_FILE_C is still EMPTY.
    Please let me know if you know of any example where I can extract data in ASCII format from a PDF File.
    Please NOTE - I do NOT need to convert a spool to PDF File (whole website is full of this) - I need the opposite !!!
    Help will be much appreciated.
    Regards,
    Tarun
    Message was edited by: Matthew Billingham - email address removed

    Hello Manish,
    Thanks a lot for your suggestion. This pdf file is really not a 1 to 1 representation of ASCII to Hex and vice verse. Your suggestion is really good.
    I think, we are very close. Do you know the Function Module name that I need to use - this is what we have in ECC / R/3. An example with which Function module I need to use with some sample code - basically, what I need to supply and where does the result go - will be great.
    Thanks again Manish.
    INCLUDE LSSXPU01.   "SXPG_STEP_XPG_START
    INCLUDE LSSXPU02.   "SXPG_STEP_END
    INCLUDE LSSXPU03.   "SXPG_STEP_COMMAND_START
    INCLUDE LSSXPU04.   "SXPG_JOB_END
    INCLUDE LSSXPU05.   "SXPG_STEP_START_UPDATE
    INCLUDE LSSXPU06.   "SXPG_STEP_END_UPDATE
    INCLUDE LSSXPU07.   "SXPG_JOB_END_UPDATE
    INCLUDE LSSXPU08.   "SXPG_COMMAND_CHECK
    INCLUDE LSSXPU09.   "SXPG_DUMMY_COMMAND_CHECK
    INCLUDE LSSXPU10.   "SXPG_APPSERV_RFCDEST_GET_INT
    INCLUDE LSSXPU11.   "SXPG_RFCDEST_OPEN_INT
    INCLUDE LSSXPU12.   "SXPG_COMMAND_CHECK_INT

  • How to convert the character value to currency/numeric

    Hi,
    See the sample code here
    data: v_qtr_field(7).
    data: w_low_limit like glt0-kslvt,
          w_amount like glt0-hslvt.
    w_low_limit = 02.
    w_max_period = 3.
    concatenate 'HSL' w_low_limit into v_qtr_field.
    *comment
    *I am looking for a field formation thru above code like in GLT0 table like HSL02,HSL03 *etc based on the value user entered in the selection *screen
    DO w_max_period TIMES
      VARYING w_amount FROM v_qtr_field NEXT v_qtr_field + 1.
       t_trans_values-dmbe2 = t_trans_values-dmbe2 + w_amount.
      ENDDO.
    I am facing problem in the Do loop as it wont allows multiple data types. can you suggest me how to convert the v_qtr_field whose data type is character to currency?

    Hi,
    Please check this code .
    PERFORM write_currency
                  USING buf_anla-urwrt t_dates-waers t_txw_anla-urwrt.
    *       FORM WRITE_CURRENCY                                           *
    *       convert currency amount to string                             *
    *       - use decimal point                                           *
    *       - remove separator characters                                 *
    *  -->  P_AMOUNT                                                      *
    *  -->  P_CURRENCY_UNIT                                               *
    *  -->  P_STRING                                                      *
    FORM WRITE_CURRENCY
         USING P_AMOUNT        TYPE P
               P_CURRENCY_UNIT LIKE TCURC-WAERS
               P_STRING        TYPE C.
      DATA: DEC2POINT(2) TYPE C VALUE ',.'.
    * convert separator to decimal point
      WRITE P_AMOUNT TO P_STRING CURRENCY P_CURRENCY_UNIT
            NO-GROUPING
            NO-SIGN
            LEFT-JUSTIFIED.
      TRANSLATE P_STRING USING DEC2POINT.
    * put minus sign before number
      IF p_amount < 0.
        SHIFT P_STRING RIGHT.
        P_STRING(1) = '-'.
      ENDIF.
    ENDFORM.
    <i>Hope This Info Helps YOU.</i>
    Regards,
    Lakshmi

Maybe you are looking for

  • How to localize LiveCycle Form in different languages ?

    Dear All, I want to localize the captions of the fields in PDF Form developed using Adobe LiveCycle Designer 7.1. In order to do that, I figured out that have to prepare XML Data Source of all Captions and related text in the target language. The lan

  • Can I set flash content as wallpaper on my N95 Cla...

    Is it possible to use some flash content on a N95 Classic as a Wallpaper. If yes, please advise as to how can I set a flash lite file (.swf extension or .fla extension) as Wallpaper on my Nokia N95 with firmware version 21.0.0.16. Also please let mem

  • Creating entry in table COSS

    Hi All, I want to create an entry in table COSS.. if any transaction please tell me.... or any other ways.... Please help me... Thnx Rohit

  • Templates in SCVMM 2008 R2 and SCVMM 2012 R2

    Hi Experts, I have few questions regarding VM Template creation using SCVMM. 1. What is the difference between VM templates in SCVMM 2008 R2 and SCVMM 2012 R2 ? 2. I could not see the three folders (Snapshots, Virtual hard disks and Virtual Machines)

  • Possible to crop outside the image limits?

    In Photoshop, you can crop an image outside of the image's boundaries and photoshop will add a colored background to the extended area. Is this possible to do in Aperture? Here is an example of the end result of what I am talking about on flickr: htt