Parsing an string by occurances of "-", and an expert opinion of alternative

Hi Everyone I have a drop down with this format data:
"001-9122-349-0000-000000-001-00-000"
Need the data be parsed at "-" occurrence, which essentially breaks into 8 parts, and then populated into individual text fields!
Does anyone have a script to do this? or a suggestion to do it smarter?

If the fields are named something like Text1 to Text8 you can use this code as the field's custom validation script (make sure you tick the option to commit the selected value immediately):
var v = event.value.split("-");
for (var i=1; i<=8; i++)
     this.getField("Text"+i).value = v[i];

Similar Messages

  • Parse a String with FIRSTNAME MI and LASTNAME but not always a MI

    Anyone,
    can I write a single clause to parse a column that cotains first name, middle initial and Last name but the Middle initial is sometimes there and sometimes not?
    Like this:
    Steven F Abbott
    Mikel Allums (Steve)
    Pedro A Arroyo
    Daniel R. Hasbrook
    Steve G Ball
    Ernie C Bloecher
    Richard Carrillo
    James M Chamberlain
    I need data seperated.
    I have:
    SUBSTR(NAME, 1, (INSTR(NAME,' ',1,1)-1)) "FIRST_NAME",
    SUBSTR(NAME,(INSTR(NAME,' ',1,1)+1), LENGTH(NAME)) "LAST_NAME",
    But that middle initial presents problems and I see it as first letter in last name but if I chnage the search for space to second occurance I get the whole name:
    SUBSTR(NAME,(INSTR(NAME,' ',1,2)+1), LENGTH(NAME)) "LAST_NAME",
    Any help would be greatly appreciated.
    Thanks,
    Miller

    may this eaxmple is little better if there is only one name then will display as first anem only
    SQL> WITH T AS
      2       (
      3          SELECT 'john smith' col1  FROM DUAL
      4          UNION ALL
      5          SELECT 'Derick R Alias' FROM DUAL
      6          UNION ALL
      7          SELECT 'Michel M john'  FROM DUAL
      8          UNION ALL
      9          SELECT 'Kiren'  FROM DUAL)
    10  SELECT (CASE
    11             WHEN INSTR (col1, ' ') = 0
    12                THEN col1
    13             ELSE SUBSTR (col1, 1, INSTR (col1, ' ') - 1)
    14          END
    15         ) first_name,
    16         CASE
    17            WHEN INSTR (col1, ' ', 1, 2) > 0
    18               THEN SUBSTR (col1, INSTR (col1, ' '), 2)
    19            ELSE NULL
    20         END middle_name,
    21         (CASE
    22             WHEN INSTR (col1, ' ', 1, 2) > 0
    23                THEN SUBSTR (col1, INSTR (col1, ' ', 1, 2) + 1)
    24             WHEN INSTR (col1, ' ') = 0
    25                THEN NULL
    26             ELSE SUBSTR (col1, INSTR (col1, ' ') + 1)
    27          END
    28         ) last_name
    29    FROM T;
    FIRST_NAME     MI LAST_NAME
    john              smith
    Derick          R Alias
    Michel          M john
    Kiren

  • Parsing a string in PL/SQL?

    I am parsing a string in PL/SQL and at a certain point(Length 45) of the string I would like to add a carriage return (Chr(10)), then continue with the string at that point and then again if the string is greater than Length 45 add a carriage return.
    I program in Powerbuilder and have figured it out, but I have a problem when trying to add a carriage return at a certain point in the string in PL/SQL. There is the REPLACE(), but that will replace everything, but I only want to add it at that certain point of the string. With the PB function I can add the carriage return at a certain point, see code:
    Li_pos = PosA( Ps_data, '*')
    DO WHILE Li_pos > 0
    ll_length = Li_pos - ll_old_pos
    IF ll_length > 45 THEN
    ll_old_pos = Li_pos
    Ps_data = ReplaceA( Ps_data, Li_Pos, 1, ls_carriage_rtn) **This function gives me the ability to add a carriage return at a certain point in the string. **
    Li_pos = PosA( Ps_data, '*', Li_pos + 1 + ls_carriage_rtn)
    ELSE
    Li_pos = PosA( Ps_data, '*', Li_pos + 1)
    END IF
    LOOP
    I have incorporated the same logic in PL/SQL but I am looking for something similar to the ReplaceA function in PB, that will replace at a certain point in a string. I use an '*' as a placeholder and measure the length. Below is the PL/SQL code:
    t_pos NUMBER;
    t_old_pos NUMBER;
    t_length NUMBER;
    BEGIN
    t_old_pos := 0;
    t_pos := INSTR(in_model_list, '*');
    WHILE t_pos > 0 LOOP
    t_length := t_pos - t_old_pos; -- This looks at current position minus the old position, measures the length
    IF t_length > 45 THEN
    t_old_pos := t_pos;
    *** add that carriage return
    t_pos := INSTR(in_model_list, '*', t_pos + 1 + Chr(10)); -- get the new position
    NULL;
    ELSE
    t_pos := INSTR(in_model_list, '*', t_pos + 1);
    END IF;
    NULL;
    END LOOP;
    Here is the data, what it looks like: William 112,* 500-A,* 500-U,* 520,* 560-A,* 560-E,* 680-E,* 680-F,* 680-V*
    Any help would be much appreciated.
    Thank you,
    William
    Edited by: William on Feb 28, 2012 6:56 AM

    Frank Kulash wrote:
    [example]I played with your example and came to this:SQL> WITH my_string AS
      2         (SELECT '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'
      3                   AS mt
      4            FROM DUAL)
      5     ,  line_length AS
      6         (SELECT 13 AS chars
      7            FROM DUAL)
      8      SELECT LISTAGG (REGEXP_SUBSTR (mt,'(.{'|| line_length.chars|| '})', 1, LEVEL),chr(10)) WITHIN GROUP (ORDER BY LEVEL)
      9             ||chr(10)
    10             ||substr(mt,-mod(LENGTH (mt),line_length.chars)) as wrapped_text
    11        FROM my_string
    12        CROSS JOIN line_length
    13  CONNECT BY LEVEL < 1+LENGTH (mt) ;
    WRAPPED_TEXT
    1234567890123
    4567890123456
    7890123456789
    0123456789012
    3456789012345
    6789012345678
    9012345678901
    2345678901234
    5678901234567
    8901234567890
    1234567890123
    WRAPPED_TEXT
    4567890123456
    7890
    SQL>*[Edit]* annotated that this is 11g only...
    Edited by: T.PD on 29.02.2012 21:17

  • Question on parsing a string and storing it, help!

    im doing a assignment and a part of it requires getting a string from the user and storing it.
    for example:
    string given was "a / b , c / d"
    the only data i would store into my array would be the chars but the length is not always given which means it can be a / b or longer. is there any way i can parse it while ignoring the whitespaces. so the array after being parsed is
    arrayOfChars[0] = a
    arrayOfChars[1] = b
    arrayOfChars[2] = c
    arrayOfChars[3] = d
    any sugguestions on how i would parse a string that will be separated by symbols such as / , ! * ? i was told there was a split() that would do the job or the string tokenizer which was what i woulve used.
    THANKS IN ADVANCE!

    only letters would be found. just run the following code (fixed some typos as well...):
    String myString = "a , 1";
    StringBuffer sb = new StringBuffer ();
    for (int i=0; i<myString.length(); i++) {
         if (Character.isLetter(myString.charAt(i))) sb.append(myString.charAt(i));
    System.out.println(sb.toString());the result will be "a". if you want digits to be found too, you must check for Character.isDigit() as well...

  • Parsing a string in a sproc

    I have a Java class that calls a stored proc and passes a stringbuffer object to it. The sproc should parse the string to retrieve the different ids that are concatenated in the stringbuffer and for each id retrieve a row from a table and in the end return a cursor containing the returned rows.Can anyone help me out with the parsing logic for a pipe delimited string.
    Tathagata

    This might help you. If you want to handle the cursor in java, then convert the below into a function which returns the cursor.
    SQL> CREATE TABLE EMP(ENAME VARCHAR2(100),ENO NUMBER(5),DEPT NUMBER(5))
      2  /
    Table created.
    SQL> INSERT INTO EMP VALUES('SCOTT',1,2);
    1 row created.
    SQL> INSERT INTO EMP VALUES('TIGER',2,5);
    1 row created.
    SQL> INSERT INTO EMP VALUES('THOMAS',3,10);
    1 row created.
    SQL> INSERT INTO EMP VALUES('PETER',4,10);
    1 row created.
    SQL> INSERT INTO EMP VALUES('HARRY',7,10);
    1 row created.
    SQL> CREATE OR REPLACE PROCEDURE PARSE_STRING(STR VARCHAR2)
      2  AS
      3  TYPE EmpCurTyp IS REF CURSOR;
      4  emp_cv EmpCurTyp;
      5  STRING VARCHAR2(1000);
      6  type emp_t is table of emp%rowtype;
      7  emp_tab emp_t;
      8  BEGIN
      9  STRING := REPLACE(STR,'|',',');
    10  OPEN emp_cv FOR 'SELECT ENAME,ENO,DEPT FROM EMP WHERE ENO IN('||string||')';
    11  FETCH emp_cv BULK COLLECT INTO EMP_TAB;
    12  CLOSE emp_cv;
    13  FOR I IN 1..EMP_TAB.LAST
    14  LOOP
    15  DBMS_OUTPUT.PUT_LINE(EMP_TAB(I).ENAME);
    16  END LOOP;
    17  EXCEPTION
    18  WHEN OTHERS THEN
    19  DBMS_OUTPUT.PUT_LINE('ERROR OCCURED ' || SQLCODE ||' ' || SQLERRM);
    20  END;
    21  /
    Procedure created.
    SQL> set serveroutput on;
    SQL> BEGIN
      2  PARSE_STRING('1|2|3|4');
      3  END;
      4  /
    SCOTT
    TIGER
    THOMAS
    PETER
    PL/SQL procedure successfully completed.
    SQL>Regards,
    Mohana

  • Anyone know how I can parse this string?

    Hello everyone!
    I'm using the Scanner class (which is like the StringTokenizer class but suppose to be more powerful).
    Anyways, I have the following String:
    OP '1.3.12.2.1004.212'.'1.3.12.2.1004.195'
    I want to parse the String so I have the following:
    '1.3.12.2.1004.212'
    '1.3.12.2.1004.195'
    so basically just parse it by the middle dot, I tried useDelimeter function and it doesn't parse it up at all. You would think it would have parsed every occurance of . but that isn't the case.
    Here is my code:
    else if(line.contains("OP"))
                             System.out.println("HIT THE SUBFIELD PART lulz");
                             String subClassName = "";
                             String subFieldName = "";
                             scan = new Scanner(line);
                             scan.useDelimiter(".");
                             System.out.println("LINE: " + line);
                             while(scan.hasNext())
                                  System.out.println("Token: " + scan.next());
                             }The output is the following:
    HIT THE SUBFIELD PART LOL
    LINE: OP '1.3.12.2.1004.212'.'iPAddress'
    Token:
    Token:
    Token:
    Token:
    Token:
    Token:
    Token:
    Any ideas what I can do to parse it up the way I mentioned above? thanks!

    hm..it just occured to me I could do the following
    else if(line.contains("OP"))
                             System.out.println("HIT THE SUBFIELD PART lulz");
                             String subClassName = "";
                             String subFieldName = "";
                             scan = new Scanner(line);
                             scan.skip("OP");
                             scan.useDelimiter("'.'");
                             System.out.println("LINE: " + line);
                             while(scan.hasNext())
                                  System.out.println("LOOK HERE: " + scan.next());
                             }I get the following output:
    LINE: OP '1.3.12.2.1004.212'.'iPAddress'
    LOOK HERE: '1.3.12.2.1004.212
    LOOK HERE: iPAddress'
    So I guess I can just manually manipulate that last token and readd the ' character!
    I think thats what I will do but if you can find a bettter solution let me know! thanks! :D

  • Parsing a string using StringTokenizer

    Hi,
    I want to parse a string such as
    String input = ab{cd}:"abc""de"{
    and the extracted tokens should be as follows
    ab
    cd
    "abc""de"
    As a result, I used the StringTokenizer class with deilmeter {,},:
    StringTokenizer tokenizer = new StringTokenizer(input,"{}:", true);
    In this was, I can separate the tokens and also can get the delimeters. The problem is I don't know how to parse the string that has double quote on it. If a single quote " is taken as a delimeter then
    ", abc, ",", de," all of them will be taken as a separate token. My intention is to get the whole string inside the double quote as a token including the quotes on it. Moreover, if there is any escape character "", it should be also included in the token. Help please.
    Thanks

    A bit of a "sticky tape"-solution...
    import java.util.StringTokenizer;
    public class Test {
        public static void main(String[] args) {
            String input = "ab{cd}:\"abc\"\"de\"";
            StringTokenizer st = new StringTokenizer(input, "{}:", true);
            while(st.hasMoreTokens()) {
            String token = st.nextToken();
            if(token.startsWith("\"") && token.endsWith("\"")) {
            token = token.substring(1,token.length()-1);
                System.out.println(token);
    }

  • Getting Error while creating Document object  after  parsing XML String

    Hi All,
    I have been trying to parse an XML string using the StringReader and InputSource interface but when I am trying to create Document Object using Parse() method getting error like
    [Fatal Error] :2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    seorg.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    Please find the code below which i have been experimenting with:
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.IOException;
    import java.io.StringReader;
    import java.util.List;
    import java.util.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    import java.io.*;
    public class TestMain {
         public static void main(String[] args) {
              String file = "";
              file = loadFileContent("C:\\Test.xml");
              System.out.println("contents >> "+file);
              parseQuickLinksFileContent(file);
    public static void parseQuickLinksFileContent(String fileContents) {
    PWMQuickLinksModelVO objPWMQuickLinksModelVO = new PWMQuickLinksModelVO();
         try {
    DocumentBuilderFactory factory =           DocumentBuilderFactory.newInstance();
         DocumentBuilder builder = factory.newDocumentBuilder();
         StringReader objRd = new StringReader(fileContents);
         InputSource objIs = new InputSource(objRd);
         Document document = builder.parse(objIs); // HERE I am getting Error.
         System.out.println(document.toString());
    What is happening while I am using builder.parse() method ???
    Thanks,
    Rajendra.

    Getting following error
    [Fatal Error] :2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    seorg.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.

  • Parsing formatted String to Int

    How can I parse formatted string to Integer ?
    I have a formated string like this $900,000 and I need to convert it to 900000 so I could do calculations with it.
    I tried something like this
    NumberFormat nf = NumberFormat.getIntegerInstance(request.getLocale());
    ttlMargin=nf.parse(screenVal);I got this exception
    "java.lang.NumberFormatException: For input string: "$1,050,000""

    I am working on the JSP file that provides
    margins,sales etc. I am reading this data off the
    screen where it is beeing displayed according to the
    accounting practices.
    That's why I get it as a formatted string and why I
    am trying covert that string to the numberScreen-scraping is a problematic, bad design. It sounds like what you really want is to call a web service which returns its results as data that a program can understand (XML, for example), not HTML (which is meant more for humans to read). I know, you probably can't change the design at this point... just food for thought. In the meantime, you'll probably have to manually parse those strings yourself by stripping out the '$' and ',' characters and then use parseInt on the result.

  • How to parse a string containing xml data

    Hi,
    Is it possible to parse a string containing xml data into a array list?
    my string contains xml data as <blood_group>
         <choice id ='1' value='A +ve'/>
         <choice id ='2' value='B +ve'/>
             <choice id ='3' value='O +ve'/>
    </blood_group>how can i get "value" into array list?

    There are lot of Java XML parsing API's available, e.g. JAXP, DOM4J, JXPath, etc.
    Of course you can also write it yourself. Look which methods the String API offers you, e.g. substring and *indexOf.                                                                                                                                                                                                                                                                                                                                                                                                               

  • Passing / parsing XML String IN / OUT from PL / SQL package

    Hello, People !
    I am wondering where can I find exact info (with code sample) about following :
    We use Oracle 8.1.6 and 8.1.7. I need to pass an XML String (could be from VARCHAR2 to CLOB) from VB 6.0 to PL/SQL package. Then I need to use built in PL/SQL XML parser to parse given string (could be large hierarchy of nodes)
    and the return some kind of cursor thru I can loop and insert data into
    different db Tables. (The return value may have complex parent/child data relationship - so I am not sure If this should be a cursor)
    I looked online many site for related info - can't find what I am looking
    for - seems like should be a common question.
    Thanx a lot !

    Hello, People !
    I am wondering where can I find exact info (with code sample) about following :
    We use Oracle 8.1.6 and 8.1.7. I need to pass an XML String (could be from VARCHAR2 to CLOB) from VB 6.0 to PL/SQL package. Then I need to use built in PL/SQL XML parser to parse given string (could be large hierarchy of nodes)
    and the return some kind of cursor thru I can loop and insert data into
    different db Tables. (The return value may have complex parent/child data relationship - so I am not sure If this should be a cursor)
    I looked online many site for related info - can't find what I am looking
    for - seems like should be a common question.
    Thanx a lot !

  • How to parse a string in CVP 7.0(1). Is there a built-in java class, other?

    Hi,
    I need to parse,in CVP 7.0(1), the BAAccountNumber variable passed by the ICM dialer.  Is there a built-in java class or other function that would help me do this?
    Our BAAccountNumber variable looks something like this: 321|XXX12345678|1901|M. In IP IVR I use the "Get ICM Data" object to read the BAAccountNumber variable from ICM and then I use the "token index" feature to parse the variable (picture below).
    Alternately, IP IVR also has a Java class that allows me to do this; the class is "java.lang.String" and the method is "public int indexOf(String,int)"
    Is there something equivalent in CVP 7.0(1)?
    thanks

    Thanks again for your help.  This is what I ended up doing:
    This configurable action element takes a string seperated by two "|" (123|123456789|12)
    and returns 3 string variables.
    you can add more output variables by adding to the Setting array below.
    // These classes are used by custom configurable elements.
    import com.audium.server.session.ActionElementData;
    import com.audium.server.voiceElement.ActionElementBase;
    import com.audium.server.voiceElement.ElementData;
    import com.audium.server.voiceElement.ElementException;
    import com.audium.server.voiceElement.ElementInterface;
    import com.audium.server.voiceElement.Setting;
    import com.audium.server.xml.ActionElementConfig;
    public class SOMENAMEHERE extends ActionElementBase implements ElementInterface
         * This method is run when the action is visited. From the ActionElementData
         * object, the configuration can be obtained.
        public void doAction(String name, ActionElementData actionData) throws ElementException
            try {
                // Get the configuration
                ActionElementConfig config = actionData.getActionElementConfig();
                //now retrieve each setting value using its 'real' name as defined in the getSettings method above
                //each setting is returned as a String type, but can be converted.
                String input = config.getSettingValue("input",actionData);
                String resultType = config.getSettingValue("resultType",actionData);
                String resultEntityID = config.getSettingValue("resultEntityID",actionData);
                String resultMemberID = config.getSettingValue("resultMemberID",actionData);
                String resultTFNType = config.getSettingValue("resultTFNType",actionData);
                //get the substring
                //String sub = input.substring(startPos,startPos+numChars);
                String[] BAAcctresults = input.split("\\|");
                //Now store the substring into either Element or Session data as requested
                //and store it into the variable name requested by the Studio developer
                if(resultType.equals("Element")){
                    actionData.setElementData(resultEntityID,BAAcctresults[0]);
                    actionData.setElementData(resultMemberID,BAAcctresults[1]);
                    actionData.setElementData(resultTFNType,BAAcctresults[2]);
                } else {
                    actionData.setSessionData(resultEntityID,BAAcctresults[0]);
                    actionData.setSessionData(resultMemberID,BAAcctresults[1]);
                    actionData.setSessionData(resultTFNType,BAAcctresults[2]);
                actionData.setElementData("status","success");
            } catch (Exception e) {
                //If anything goes wrong, create Element data 'status' with the value 'failure'
                //and return an empty string into the variable requested by the caller
                e.printStackTrace();
                actionData.setElementData("status","failure");
        public String getElementName()
            return "MEDDOC PARSER";
        public String getDisplayFolderName()
            return "SSC Custom";
        public String getDescription()
            return "This class breaks down the BAAccountNumber";
        public Setting[] getSettings() throws ElementException
             //You must define the number of settings here
             Setting[] settingArray = new Setting[5];
              //each setting must specify: real name, display name, description,
              //is it required?, can it only appear once?, does it allow substitution?,
              //and the type of entry allowed
            settingArray[0] = new Setting("input", "Original String",
                       "This is the string from which to grab a substring.",
                       true,   // It is required
                       true,   // It appears only once
                       true,   // It allows substitution
                       Setting.STRING);
            settingArray[1] = new Setting("resultType", "Result Type",
                    "Choose where to store result \n" +
                    "into Element or Session data",
                    true,   // It is required
                    true,   // It appears only once
                    false,  // It does NOT allow substitution
                    new String[]{"Element","Session"});//pull-down menu
            settingArray[1].setDefaultValue("Session");
            settingArray[2] = new Setting("resultEntityID", "EntityID",
              "Name of variable to hold the result.",
              true,   // It is required
              true,   // It appears only once
              true,   // It allows substitution
              Setting.STRING);  
            settingArray[2].setDefaultValue("EntityID");
            settingArray[3] = new Setting("resultMemberID", "MemberID",
                    "Name of variable to hold the result.",
                    true,   // It is required
                    true,   // It appears only once
                    true,   // It allows substitution
                    Setting.STRING);  
            settingArray[3].setDefaultValue("MemberID");
            settingArray[4] = new Setting("resultTFNType", "TFNType",
                      "Name of variable to hold the result.",
                      true,   // It is required
                      true,   // It appears only once
                      true,   // It allows substitution
                      Setting.STRING);  
            settingArray[4].setDefaultValue("TFNType");    
    return settingArray;
        public ElementData[] getElementData() throws ElementException
            return null;

  • Date contructor deprecation : Parsing a String to Date

    Hi All,
    In Java 1.5 the Date() constructor Date(String s) is deprecated. As per the API Documentation DateFormat.Parse() method is used.
    The following code from Java 1.4 version has to be upgraded to Java 1.5.
    Existing Code:
    Date dDate = new Date(sDate);
    Modified Code:
    DateFormat df = DateFormat.getDateInstance();
    Date dDate = df.parse(sDate);
    Here the DateFormat accepts a default formatting style as "Feb 01, 2007" and parses the String.
    If the String sDate belongs to any other formatting style such as "01 Feb, 2007" or "01 Feb, 07" the code piece throws unparsable date error.
    Please give your thougts on this issue to parse the string of any format..
    Thanks,
    Rajesh.

    Hi All,
    In Java 1.5 the Date() constructor Date(String s) is
    deprecated. As per the API Documentation
    DateFormat.Parse() method is used.
    The following code from Java 1.4 version has to be
    upgraded to Java 1.5.
    Existing Code:
    Date dDate = new Date(sDate);
    Modified Code:
    DateFormat df = DateFormat.getDateInstance();
    Date dDate = df.parse(sDate);
    Here the DateFormat accepts a default formatting
    style as "Feb 01, 2007" and parses the String.
    If the String sDate belongs to any other formatting
    style such as "01 Feb, 2007" or "01 Feb, 07" the code
    piece throws unparsable date error.
    Please give your thougts on this issue to parse the
    string of any format..You can't. What date is this: "08/04/24"? 8 April, 1924? 4 August, 2024?
    >
    Thanks,
    Rajesh.

  • Parsing a string to integer gives 0 in Integer

    Hi ,
    try
    usid = Integer.valueOf(usi).intValue();
    catch(NumberFormatException e)
         text = "NUMber";
    in the above code the value of usi is 4
    then parsing it is giving me 0 in usid
    try
    usid = Integer.parseInt(usi);
    catch(NumberFormatException e)
         text = "NUMber";
    I also tried the above code the result is same

    Also the OP didn't say which version of JDK he was using.
    With JavaSE5 and JavaSE6 , there's a new feature called autoboxing , which eliminates the need to cast from a String to an Integer , and then to get an int value .
    Insead one could simply write code like this and i works:
    Integer someInteger = 123;
    int anInt = 555;
    someInteger = anInt; 
    anInt = someInteger;Autoboxing and Autounboxing : http://java.sun.com/j2se/1.5.0/docs/guide/language/autoboxing.html
    But the article further adds:
    So when should you use autoboxing and unboxing? Use them only when there is an �impedance mismatch� between reference types and primitives, for example, when you have to put numerical values into a collection. It is not appropriate to use autoboxing and unboxing for scientific computing, or other performance-sensitive numerical code. An Integer is not a substitute for an int; autoboxing and unboxing blur the distinction between primitive types and reference types, but they do not eliminate it.
    Message was edited by:
    appy77

  • Parsing a string in a given order

    Hi All,
    I want to parse a string and rank it in a given order.
    Eg : i have a string as 'A | B | C | D'. I would like to parse this string and give a rank in order.
    It should appear as below.
    Parsed string order
    D 1
    C 2
    B 3
    A 4
    Any help is greatly appreciated..

    A database version would help us providing you with a relevant solution.
    Starting with 10g, you can do :
    SQL> var my_str varchar2(30)
    SQL> exec :my_str := 'A|B|C|D'
    PL/SQL procedure successfully completed
    SQL> select item
      2       , row_number() over(order by item desc) as rank
      3  from (
      4    select regexp_substr(:my_str,'[^|]+',1,level) as item
      5    from dual
      6    connect by level <= length(regexp_replace(:my_str,'[^|]+')) + 1
      7  );
    ITEM                    RANK
    D                          1
    C                          2
    B                          3
    A                          4
    In 11.2 :
    SQL> select *
      2  from xmltable(
      3       'for $i in ora:tokenize($str,"\|") order by $i descending return $i'
      4       passing 'A|B|C|D' as "str"
      5       columns item varchar2(10) path '.'
      6             , rank for ordinality
      7       )
      8  ;
    ITEM             RANK
    D                   1
    C                   2
    B                   3
    A                   4
    Edited by: odie_63 on 11 janv. 2012 12:56 - added 11.2

Maybe you are looking for

  • Should I buy the new MacBook Air or a MacBook Pro

    Should I buy the new MacBook Air or the MacBook Pro?

  • Problem in Transporting Data in test environment

    Hi, I've added some new attributes to an existing object. I load it in Developement environment, everything is working fine in that. But when I transported the object and Transfer rules in Test environment, the data in new fields is not getting loade

  • Error opening Oracle BI Presentation Services

    I am new to obiee. Finished installing Oracle 11g, Oracle BI 10.1.3.4.0, jdk1.6.0-07. I am able to create new repository in BI Administartor Tool. Error while trying to connect to Presentation Services. Theses are the various errors: when connecting

  • How to make lines for "fill in the blanks?" (iWork Pages 09)

    This should be easy since it's something many people do: design a form for others to fill out with a pen or pencil.  However, I can't find any information regarding how to make a line after text, like this: Name _________________ Address ____________

  • Serious Overheating (?) killed my macbook...

    I have a late 2008 macbook 13" that I had a problem or two with in the past.  Aside from cracking the lcd, I started noticing the macbook getting extremely hot and would occasionally shutdown without notice/warning.  The battery in it was run-down an