I need a java function that convert string to ASCII,

I have a string like "test123"
I want to convert this string to ascii code?how could I do this

It is not compeltely clear, what you need, but String has this method:
public byte[] getBytes(String charsetName)  throws UnsupportedEncodingException

Similar Messages

  • Problems with PL/SQL Calling Java Function that returns String []

    Hi,
    I have written the following code. It's not compiling OK.
    DECLARE
    TYPE Tokens_Type IS VARYING ARRAY(20) OF VARCHAR2(20);
    s1 Tokens_Type DEFAULT NULL;
    SQL_STR VARCHAR2(2000) DEFAULT NULL;
    BEGIN
    SQL_STR := 'CREATE OR REPLACE FUNCTION Schema1.SPLIT_STR (S2 VARCHAR2(20)) ' ||
    'RETURN s1 ' ||
    'AS LANGUAGE JAVA ' ||
    'NAME ''String_Mani.split_it (String) return java.lang.String []''';
    EXECUTE IMMEDIATE SQL_STR;
    END;
    What's the problem with this?

    You cannot create a function with a locally defined return type. As soon as this script is executed, Oracle no longer knows what the TOKEN_TYPE type is any more, so the function will be invalid.
    You need to use a collection type defined at the database level or defined in a package - somewhere where it will persist.

  • Convert String from ASCII to ANSI

    Hi,
    a command line instruction via LabVIEW function "System Exec.vi" retrieves me a string in ASCII format. Is there a function to convert string from ASCII to ANSII format? I use LabVIEW 8.5 German Installation.
    Kind Regards
    Christian
    Test Engineering
    digades GmbH
    www.digades.com

    Hallo Christian,
    AFAIK there is no such in function in LabView...
    But you can:
    - use "Search and replace string" to search for ASCII chars and replace them by their corresponding ANSI char, do this in a loop for all chars to be replaced (acceptable speed for small strings...)
    - convert the string to an U8 array and use a lookup table to convert all bytes from ASCII to ANSI, convert back to string (may be faster for long strings...)
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Create a function that convert date Gregorian calendar to Hijri calendar

    hey guys, i had an assesment i need to finish as my test for flash developer vacancy...
    i need to create a function that convert date Gregorian calendar to Hijri calendar in flash
    is that possible??
    i've search through google, but still doesnt find anything useful yet..
    kinda need ur help plz.....

    http://www.codeproject.com/KB/datetime/hijrigregorianclass.aspx

  • External java function that should return String array

    Hi everyone,
    I have a split function in plsql that takes 10 times longer a java tokenizer function that i was written. So, i want to use java external function to split my plsql strings into pieces.
    I can write a java external procedure that returns types like int, float and String types. I have no problem about it.
    My problem is returning an array of strings. I found a book that has an example about how can we get directory list in plsql with java external procedure.
    (code)
    import java.io.File;
    import java.sql.*;
    import oracle.sql.*;
    import oracle.jdbc.*;
    public class JFile {
    public static oracle.sql.ARRAY dirlist (String dir)
    throws java.sql.SQLException
    Connection conn = new OracleDriver().defaultConnection( );
    ArrayDescriptor arraydesc =
    ArrayDescriptor.createDescriptor ("DIRLIST_T", conn);
    File myDir = new File (dir);
    String[] filesList = myDir.list( );
    ARRAY dirArray = new ARRAY(arraydesc, conn, filesList);
    return dirArray;
    CREATE OR REPLACE FUNCTION dirlist (dir IN VARCHAR2)
    RETURN dirlist_t
    AS
    LANGUAGE JAVA
    NAME 'myFile.dirlist(java.lang.String) return oracle.sql.ARRARY';
    (code)
    I could compile this source file in localhost but not remotehost. There are jar files ( import oracle.sql.*; import oracle.jdbc.*; ) that should be added to remote classpath. ( others have already added java classpath ). But, which classpath i should add? Oracle has own JVM and Classpath, probably i should upload these jar files to oracle classpath. Am i wrong? How can i do? Can you explain in detail? How can i return string array from java external function in Oracle ?
    I am using Oracle 11.1.0.7 on Solaris Sparc Machine.

    Hi,
    What do you mean "compile in remote host"
    Aren't you using the loadjava tool? - that should be enough, the RDBMS already "has" the jars needed.
    [A must read|http://download.oracle.com/docs/cd/B28359_01/java.111/b31225/chone.htm#BABCFIIF]
    Regards
    Peter

  • Function to convert string to number

    Hi there,
    I wrote a function which converted a hor minute component of a date to a number. Now I need to do the same with a string (because the hours could be more then 23:95). Anyway here is my function. How can I rewrite it so it will accept a string as in parameter. Somwhow I can not work it out. Thanks a lot.
    Chris
    function calculate_hours_project(in_hours in DATE)
    RETURN number
    AS
    hrs CHAR(2);
    mins CHAR(2);
         BEGIN
              hrs := to_char(in_day, 'HH24');
              mins := to_char(in_day, 'MI');
              if hrs is not null and mins is not null then
              RETURN to_number(hrs + (mins/60));
              else
              RETURN 0;
              end if;
    END calculate_hours_project;

    Wouldn't it just be something like this?
    sql>create or replace function calculate_hours_project(in_hours in varchar2)
      2  return number
      3  is
      4  begin
      5    return to_number(substr(in_hours, 1, instr(in_hours, ':') - 1)) +
      6           to_number(substr(in_hours, instr(in_hours, ':') + 1) / 60);
      7  end calculate_hours_project;
      8  /
    Function created.
    sql>select calculate_hours_project('08:05') from dual;
    CALCULATE_HOURS_PROJECT('08:05')
                           8.0833333
    1 row selected.
    sql>select calculate_hours_project('35:34') from dual;
    CALCULATE_HOURS_PROJECT('35:34')
                           35.566667
    1 row selected.

  • Need help for FM that converts RAW format data to xls format

    Hi all,
         I am able to get the data from the given spool number to be converted into 'RAW' format. I need to convert this data into Excel format nad want to send the mail as attachment.
         I want to know is there a Function Module that converts this RAW format data into the Excel format?
    regards,
    Brijesh Patel

    Hi,
    instead of that you can do this....
    once spool is generated you have spool number , using the spool number you can generate the excel file using the FM <b>RSPO_DOWNLOAD_SPOOLJOB</b>, pass the spool number, and filename as some.xls and then it will download it to xls file,
    Regads
    vijay

  • Need some help - function that strips html tags

    Hey peeps,
    Need some guidance.
    I need help to write a function that will strip html tags from a string. So for examples if I have the following string:
    myString = "<p>This is a Paragraph</p>"; after runing the function it should return the string: "This is a Paragraph".
    Could anyone plz point me in the right direction on how to do this.
    Thanks,
    Zub

    System.out.println(myString.replaceAll("<[^>]++>\\s*", ""));

  • JavaFX : How to call java function that returns hashtable and manipulate

    I have a requirement to {color:#0000ff}create a java object in JavaFX script code{color}. Then call a java function using the created java object. The java function returns hashtable. Then traverse through each element of hashtable. Finally I need to create a similar structure in JavaFX.

    If you need to use a Java class that uses generics you need to take special steps. Since JavaFX does not support generics you need to create a java wrapper to hide the calls that use generics and call the wrapper class from FX.

  • Help with a store function that takes string array

    Hi All,
    I have a function that takes in two string arrays, status_array, and gender_array. You can see the partial code below. Somehow if the value for the string array is null, the code doesn't execute properly. It should return all employees, but instead it returns nothing. Any thoughts? THANKS.
    for iii in 1 .. status_array.count loop
    v_a_list := v_a_list || '''' || status_array(iii) || ''',';
    end loop;
    v_a_list := substr(v_a_list, 1, length(trim(v_a_list)) - 1);
    for iii in 1 .. gender_array.count loop
    v_b_list := v_b_list || '''' || gender_array(iii) || ''',';
    end loop;
    v_b_list := substr(v_b_list, 1, length(trim(v_b_list)) - 1);
    IF v_a_list IS NOT NULL and v_b_list IS NOT NULL THEN
    v_sql_stmt := 'select distinct full_name from t_employee where status in (' || v_a_list || ') and gender in (' || v_b_list || ')';
    ELSIF v_a_list IS NOT NULL and v_b_list IS NULL THEN
    v_sql_stmt := 'select distinct full_name from t_employee where status in (' || v_a_list || ') ';
    ELSIF v_a_list IS NULL and v_b_list is not null THEN
    v_sql_stmt := 'select distinct full_name from t_employee where gender in (' || v_b_list || ')';
    ELSE
    v_sql_stmt := 'select distinct full_name from t_employee';
    END IF;
    OPEN v_fullname_list FOR v_sql_stmt;
    RETURN v_fullname_list;

    I'd first recommend trying to avoid the dynamic sql.
    use an approach like
    [http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:210612357425] or
    [http://stackoverflow.com/questions/1625649/oracle-parameters-with-in-statement/1655743#1655743] or [http://stackoverflow.com/questions/1715978/how-to-use-an-oracle-associative-array-in-a-sql-query]
    but if that isn't in scope, do a
    dbms_output.putline(v_a_list) ;
    dbms_output.putline(v_b_list) ;
    dbms_output.putline(v_sql_stmt) ;around and see what it emits

  • My page has a button that, when clicked, calls a Java function that sets a PageLegend and changes an image but then FireFox reloads the page switching everything back to original values. What's up?

    This is happening with an ASP page. Not sure when it started, but the page used to work fine. The Java script is listed in the troubleshooting section. The button calls nextPic() which calls showPic(). After nextPic processes the page is reloaded.

    A good place to ask questions and advice about web development is at the mozillaZine Web Development/Standards Evangelism forum.
    The helpers at that forum are more knowledgeable about web development issues.
    You need to register at the mozillaZine forum site in order to post at that forum.
    See http://forums.mozillazine.org/viewforum.php?f=25

  • How to call a java function that is in page header from a process in page.

    Hi,
    Generally we call plsql process from a javascript in the header of that page.
    But i want the other way around.
    Is it possible or is it a completely wrong idea.
    I am thinking so because we are able to call javascripts from items and buttons why cant we do so from a process.
    Thanks and Regards,

    943323 wrote:
    Hi,
    Generally we call plsql process from a javascript in the header of that page.
    But i want the other way around.
    Is it possible or is it a completely wrong idea.
    I am thinking so because we are able to call javascripts from items and buttons why cant we do so from a process.It's a "completely wrong idea". Processes and PL/SQL run in the database on the server. JavaScript runs in the browser on the client. For basuic security reasons the browser must make requests to the server, not the other way round.
    Please update your forum profile with a real handle instead of "943323".

  • Convert string to ascii

    does anybody know how to convert a string to it's ascii code?

    does anybody know how to convert a string to it's
    ascii code?In Java characters are represented with Unicode,
    http://unicode.org
    Fortunately the commonly used Basic Latin Unicode character set corresponds to the ASCII character set. So to get the ASCII representation of a char you just interpret the char as a number.
    char ch = 'A';
    int i = ch;
    System.out.println("Both Unicode Basic Latin and ASCII use " + i + " to represent an " + ch);

  • Convert string to ASCII entities

    Does anyone know if Java has a method to change 'a' into '&#97;', 'b' into '&#98;' and so on? Or at least change 'a' into the ASCII value '97'?
    thanks.
    ben

    char c = ...; // get your char
    int ascii;
    if (c < 128) {
      ascii = c;
    else {
      throw new OutOfMemoryError("not ascii!");
    }

  • Converting String into Java code

    Hi everyone,
    I will describe the scenario I have. I have a GUI application. I want the user to write some Java code in a text box and plug that code during runtime. Is there a way in Java so that a string could be used as a Java code?
    You help is really appreciated.
    Thanks
    RG

    catch the string input
    output string (code) to file
    call javac on the file you made
    that's it, you have a class, and you can run it/load it

Maybe you are looking for

  • MR11 problem

    Hi, When MR11 is performed,some of the line items are not being picked by the system. I find that GR has been done for PO and Line items and no invoice posted for the same. Any particular reason that MR11 is not done for a particular PO and Line item

  • External Hard drives Mac OS and Windows

    I have a question on external hard drives. I am looking for an external drive that will work with both my Mac and Windows xp pro. I remember that Mac used to be able to read windows format but not vise versa. I know that thumb drives switch back and

  • How come I get no sound when I attach hdmi cable from new macbook to tv?

    i have attached an hdmi from port to television and although I get picture I get no sound

  • Attach movie clip speed increase after 2 min

    i am making a game in falsh as2 see this link to understand http://createview.in/try/game.html this function for one fruit. so there are 10 functions i want to increase speed of falling fruits after 2 min for making difficulties to user makegd is fun

  • Satellite A210-199 - (PSAFGE) - Error in the BIOS

    All good day. Faced with the problem of model notebook Toshiba A210-199 (PSAFGE) When the laptop it 2 times and knocks mail to oshybku System Configuration Data Updated and System Configuration Data Read Error Along What to do please? Thank you in ad