String Manipulation splitting

Hi , I have a peculiar issue.
There is a string of length 10.
it will always start with a numeric value however it can have alphanumeric charaters there after.
for example :
1
1A
2BC
23A
123B etc.....
I have to pick only the numeric values for comparison
like 1 ,1 , 2,23, 123 with another field that holds only numeric characters.
how can I achieve this.
THanks

Try this,
data: lv_char type c length 20 value '12ab34c5'.
data: lv_num type n length 10.
lv_num = lv_char.
write lv_num.
Thanks,
SKJ

Similar Messages

  • String Manipulation in BI Publisher Report Paramater

    Hi,
    My Problem is that I am not able to do string manipulation on BI Publisher report Prameters.
    Actually I want to Show Deptno-Dname in Menu(LOV).and when I select Certain combination like '10-Accounting',and while passing the parameter:Dept I wanted to Cut the department no(10) using string manipulation functions provided by oracle in Data Model(Query) in where clause like (where deptno=to_number(substr(:Dept,1,2)).
    This query is working fine in other application like TOAD,But not giving results in BI Publisher Report.
    It's also not giving any error while saving or running the report.
    Please suggest any solution.

    even I tried the following query in data model..
    select DISTINCT EMP.EMPNO as EMPNO,
    EMP.ENAME as ENAME,
    EMP.JOB as JOB,
    DEPT.LOC as LOC
    from SCOTT.DEPT DEPT,
    SCOTT.EMP EMP
    where emp.DEPTNO=DEPT.deptno
    and DEPT.deptno=nvl(to_number(substr(:department,1,2)),DEPT.deptno)
    But the Parameter which I want to pass say Department('10-Accounting'),
    Still it is showing employees from all departments.

  • Why is the problem? String Manipulation. Help Please.

    Ok I have two while loops that run with two different String arrays. The problem that I have is that I have a String LeadPI that looks like this: "Dr. Ayusman Sen, Pennsylvania State University".
    I would like to separate the String where the first half "Dr. Ayusman Sen" = String investigator; and "Pennsylvania State University" = String institution;
    basically separate the string into two separate String variables.
    can I do this in 1 while loop, and why is my output not functioning correctly?
    Lead PI: Dr. Ayusman Sen, Pennsylvania State University //*** String to manipulate***//
    // what the output should look like.
    Institution: Pennsylvania State University //*** this should be institution ***//
    Investigator: Dr. Ayusman Sen //*** this should be investigator ***//
    // This is the current output!
    Institution: Dr. Ayusman Sen
    Institution: Pennsylvania State University //*** this should be institution ***//
    Investigator: Dr. Ayusman Sen //*** this should be investigator. ***//
    Investigator: Pennsylvania State University
    Investigator: Dr. Ayusman Sen
    Investigator: Pennsylvania State University            
                 //********************** institution **************************//
                int count= 0;
                char separator =',';
                int index =0;
                do
                   ++count;
                   ++index;
                   index = LeadPI.indexOf(separator, index);
                while (index != -1);                       
                String[] insti = new String[count];
                index=0;
                int endIndex = 0;
                for(int i = 0; i < count; i++)
                    endIndex = LeadPI.indexOf(separator, index);
                    if(endIndex == -1)
                        insti= LeadPI.substring(index);
    else
    insti[i] = LeadPI.substring(index, endIndex);
    index = endIndex + 1;
    for(int i = 0; i < insti.length; i++)
    System.out.println("\tInvestigator: "+insti[i]);
    //********************** investigator **************************//
    index =0;
    do
    ++count;
    ++index;
    index = LeadPI.indexOf(separator, index);
    while (index != -1);
    String[] investi = new String[count];
    index=0;
    endIndex = 0;
    for(int i = 0; i < count; i++)
    endIndex = LeadPI.indexOf(separator, index);
    if(endIndex == -1)
    investi[i]= LeadPI.substring(index);
    else
    investi[i] = LeadPI.substring(index, endIndex);
    index = endIndex + 1;
    for(int i = 0; i < investi.length; i++)
    System.out.println("\tInstitution: "+investi[i]);

    Cheers!
    One of the problems with the String's split method is that it will nto handle the spaces properly. You will still need to trim it.
    In the class, below, I have coded for you two methods that will do what you are asking for.
    The first method (split) uses the String's split method, but then has to go through and trim down the strings to remove the space after the comma.
    The second method, tokenize, does the same thing, but uses a string tokenizer.
    Both work - I was just trying to illustrate both methods. The tokenizer method is about three times faster than the split method (in my tests) - but the split method is a little cleaner (IMHO) - but we're talking sub-millisecond differences in one execution.
    You would get the name from the [0] index of the returned String array and the institution from the [1] index, like so:
    System.out.println( "Name: " + info[ 0 ] );
    System.out.println( "Institution: " + info[ 1 ] );There are some issues with this code... if there is a comma in the institution name or the person's name, if messes things up - if, for example, the persons' name is "Paul Leska, Jr." - the routine splits the string in between Leska and Jr.
    The same thing happens in the institution name - if, for example, the name of the place is "University of Minnesota, Duluth" - we tokenize or split between Minnesota and Duluth.
    You'll either need to (1) watch your data, (2) make these routines smarter or (3) Change your input to already be split (from the source, perhaps).
    Here's the code:
    import java.util.StringTokenizer;
    public class Splitter {
      public static String[] split( String s, char c ) {
        String[] chopped = s.split(String.valueOf( c ));
        for( int idx = 0; idx < chopped.length; idx++ ) {
          chopped[ idx ] = chopped[ idx ].trim();
        return chopped;
      public static String[] tokenize( String s, char c ) {
        StringTokenizer st = new StringTokenizer( s, String.valueOf( c ) );
        int count = st.countTokens();
        String[] chopped = new String[ count ];
        for( int idx = 0; idx < count; idx++ ) {
          chopped[ idx ] = st.nextToken().trim();
        return chopped;
      public static void main( String[] args ) {
        String[] info = tokenize( "Michael A. Riecken, Jumping Mouse Software", ',' );
        for( int idx = 0; idx < info.length; idx++ ) {
          System.out.println( info[idx] );
        info = split( "Michael A. Riecken, Jumping Mouse Software", ',' );
        for( int idx = 0; idx < info.length; idx++ ) {
          System.out.println( info[idx] );
    }

  • String manipulation in JSTL

    Hello All
    I'm a just a beginner and I'm need to write a web page that is totally based on JSTL. I found out that the standard java tab lib in JSTL doesnt really support string manipulation or regular expression like in perl.
    As such, I would like to know what are the different options (like adding servlets/javabeans/etc) can i add to my JSTL page so that i can perform complex string manipulation to a data entered by the user in the text box?
    Some of the operations that I wish to carry out on the data are:
    1. check if data contains certain characters, strings
    2. joining and spliting strings
    3. find length of the string
    4. find the position of certain character in a string
    5. check if string match certain pattern.
    and many more.
    Would greatly appreciate if you guys can help to provide some light.
    Regards
    Beginner....

    You might find MicroNova YUZU JSP tag library (http://sourceforge.net/projects/micronova-yuzu) useful, especially if you need to support both JSP 1.2 and 2.0. Hope this helps.

  • String manipulation

    I am trying to read in a CSV file and then use the data contained in the CSV file to insert data into a database.
    I am programming in C#
    in order to do this I set up a StringReader object, open the file and read the file to the end into a string.
    To retreive each individual line I do a:
    string[] tokens = text.split('\n')
    which successfully splits up the text string into the tokens array, inserting single strings into each element.
    After this I try to repeat the procedure in order to retreive single values out of the tokens[index] strings so as to insert them into a database; herein my problem lies.
    so I have a string that looks something like this in each token array element:
    "a,b,c,d,e,f,g,h,i,etc"
    I do virtually the same operation:
    foreach(string s in tokens)
    string parts[] = s.Split(',');
    for(int i =0; i < parts.Length(); i++)
    //insert values into database
    The problem is here that splitting up each string into parts is giving me an empty array ... from what I understand it should give me an array of elements like so:
    parts[0]: "a"
    parts[1]: "b"
    parts[2]: "c"
    etc ...
    any clues you could help me with would be greatly appreciated.
    Lance

    Have you looked at just using SQL Loader to load the data straight into the database? SQL Loader was born to do this sort of stuff.
    - Mark
    =======================================
    Mark A. Williams
    Oracle DBA
    Author, Professional .NET Oracle Programming
    http://www.apress.com/book/bookDisplay.html?bID=378

  • How to implement the String class "split()" method (JDK1.4) in JDK 1.3

    is it possible , with some code, to implement the split() method of the String class......which is added in JDK1.4 ..... in JDK1.3
    would be helpful if anyone could suggest some code for this...

    Here it is
    public static String[] split(String source, char separ){
    answer=new Vector();
    int position=-1, newPosition;
    while ((newPosition=source.indexOf(separ,position+1))>=0){
    answer.add(source.subString(position+1,newPosition));
    position=newPosition;
    } //while
    answer.add(source.subString(position+1,source.length-1);
    return (String[])(answer.toArray());
    } //split

  • Advanced String Manipulation Using REGEXP

    Hello all,
    I've been trying to split a string using either REGEXP_SUBSTR and REGEXP_REPLACE functions with much success so I wonder whether anyone here can give me a hand. Basically the string I want to split in to 3 is in this format:
    'instanceno;partno;serialno'
    I have read numerous articles within last few days but I still can't get it to working (I'm sure due to my lack of regular expression handling knowledge in OBIEE). I found two articles discussing similar scenarios. One in here and the other one is here. Both of those are good, but I cannot apply those principles to my query as I'm keep getting issues with the use of semicolon (;).
    Could someone explain to me how to split this string so I can have 3 separate columns, please?
    Thanks and regards,

    Hi Anuhas,
    you have to create 3 columns in the report on 3 attribute columns inside le Logical Model with this syntax for the the string str = 'instanceno;partno;serialno'
    COLUMN1 = evaluate('regexp_substr(%1,''[^\;]+'', 1,1)',REPLACE(*str*,';','\;'))
    COLUMN2 = evaluate('regexp_substr(%1,''[^\;]+'', 1,2)',REPLACE(*str*,';','\;'))
    COLUMN3 = evaluate('regexp_substr(%1,''[^\;]+'', 1,3)',REPLACE(*str*,';','\;'))
    You have to use the REPLACE function (; --> \;) because the ; is e special character
    In this way you have:
    COLUMN1 = instanceno
    COLUMN2 = partno
    COLUMN3 = serialno
    The regex_substr(a,b,c) contains:
    a = str the string
    b = [^\;]+ find for the beginning of the string the character ;
    c = number of occurrence
    I hope it hepls.
    Regards,
    Gianluca

  • String "abcde" split to "a","b","c","d","e"..

    Hi guys,
    I'm new here, Who could tell me a way to resolve the problem??
    Now, I have a String "abcde" and I want to use the API : String.split();
    and I want the result is a String[] : "a","b","c","d","e"
    please give me some suggestion.
    thx

    Welcome to the forum.
    user11230334 wrote:
    Hi guys,
    Now, I have a String "abcde" and I want to use the API : String.split();
    and I want the result is a String[] : "a","b","c","d","e"<tt>String.split()</tt> is not able to do that.
    you have (at least) 3 options:
    1. Use regular Expression and Pattern
    2. use StringTokenizer
    3. use <tt>String.substring()</tt>
    bye
    TPD

  • Using CharAt for String Manipulation

    Hi,
    I am new to Java and am taking a Java class. I am trying to put a social security number in "nnn-nn-nnnn" format where n is a digit 0-9. I don't know if it would work with the charAt method of the String class. Does anyone have any suggestions on how to implement this kind of manipulation.
    It would be greatly appreciated!
    Thanks,
    waggypup99

    You could just create a class for social security number.
    e.g.
    public class SSNum{
        private int _num;
        public SSNum(int number){
          _num = number;
          * take number in the form  nnn-nn-nnnn
        public SSNum(String number){
          StringTokenizer st = new StringTokenizer(number,"-");
          StringBuffer numStringB = new StringBuffer(st.nextToken());
          numStringB.append(st.nextToken());
          numStringB.append(st.nectToken());
         _num = Integer.parseInt(numStringB.toString());
       public String toString(){
          //left as fun exercise
    }

  • Using a regular expression in String's split method

    I have a String that is delimited by commas that I would like to split into a String array. However, the problem is that it is valid that some of the elements could have embeded commas in them. These "extra" commas are always in a predefined pattern though.
    For example, the String that I want to parse may look like this (quotes omitted):
    data with spaces and tabs , more data with more spaces, now for the problem(5,9), and now some more text and spaces
    What I would like the result to be (shown below as if each element has been trimmed):
    data with spaces and tabs
    more data with more spaces
    now for the problem(5,9)
    and now some more text and spaces
    string.split("[,&&[^[\\(.,.\\)]]]");The idea being that I want to split on all commas except those that are in the pattern (5,9). Where 5 and 9 could be any integer.
    The above expression isn't working. It isn't ignoring the comma in the pattern.
    Any suggestions?
    Thanks.

    i dunno if this help...
    There is a class called the StringTokenizer class where it splits the String and delimiter up..e.g
    String s1="Hello,Welcome,Can";
    String[ ] arr=new String[3];
    To use the StringTokenizer, you create.
    StringTokenizer st=new StringTokenizer(s1,",");
    //this will split the words, hello,welcome and can into "Tokens"
    Then use this method .hasMoreTokens( )
    int i=0
    while(st.hasMoreTokens( ) ==true) {
    arr=st.nextToken( );
    i++;
    Hope this helps! =)

  • Most efficient way to do some string manipulation

    Greetings,
    I need to cleanse some data in a string by replacing unsafe characters with encoded equivalents. (FYI, this is for the purpose of transforming "unsafe" characters into encoded values as data inside an XML document).
    The following code accomplishes the task:
    Note that a string "currentValue" contains the data to be cleansed.
    A string, "encodedValue" contains the result.
      for (counter = 0; counter < currentValue.length(); counter++)
        addChar = (currentValue.substring(counter,counter+1));
        if (addChar.equals("<"))
          addChar = "#60;";
        if (addChar.equals(">"))
          addChar = "#62;";
        if (addChar.equals("="))
          addChar = "#61;";
        if (addChar.equals("\""))
          addChar = "#34;";
        if (addChar.equals("'"))
          addChar = "#39;";
        if (addChar.equals("'"))
          addChar = "#39;";
        if (addChar.equals("/"))
          addChar = "#47;";
        if (addChar.equals("\\"))
          addChar = "#92;";
        encodedValue += addChar;
      } // forI'm sure there is a way to make this more efficient. I'm not exactly "new" to java, but I am learning on my own with no formal training and often take a "brute force" approach with my initial effort.
    What would be the most efficient way to re-do the above?
    TIA,
    --Paul Galvin
    Integrated Systems & Services Group

    im a c++ programmer so im not totally up on these java classes either but...from a c++ stand point you might want to consider using the if else statment.
    by using if else, you only test the character until you find the actual "violating" character and skip the rest of the tests.
    also, you might trying using something to check for alphaNumeric cases first and use the continue keyword when you find one. since more of your characters are probably safe than unsafe you can skip all the ifs/if else statement and only do one test on the good characters. (i just looked for a way to test that and i didnt find one. c++ has a function that does that by checking the ascii number range. dont think that works in java. but maybe you can find one, it would reduce the number of tests probably.)
    happy hunting,
    txjump :)

  • Bank Reconciliation- String Manipulation

    Hi Gurus,
    My client using match format to reconcile.
    The Line 86 "Note to Payee " is having some additional information other than the reference no. i.e. the 12 character is required for posting, then there is "Space" and then there are some other characters, which are not used.
    We only need the first 12 character of the to match  with reference no.
    I understand that "Define Search String for Electronic Bank Statement" provides means to "take  only first 12" characters.
    How to define this? What should be in the Searching and Mapping??
    Thanks in advance

    Hi Periasamy,
      In your case, define the search string as:
    ^############( |$)
    The above will select 12 characters from the start of the field and will stop if a space comes or end of line comes.
    Then you need to use the dialog 'Search string use' and map this string to relevant bank accounts. Use Target Field as 'Check-/DME Reference-/Assignment Number'.
    -S.

  • String manipulation question (servlet)

    Hello,
    I have a problem replacing parts of a String with values from a HttpServletRequest.
    I have the following method:
    public String replaceVariables(String s, HttpServletRequest request) {
         Enumeration e = request.getParameterNames();
         Vector v = new Vector();
         while(e.hasMoreElements()) {
              v.add(e.nextElement());
         String paramName;
         ListIterator li = v.listIterator();
         while(li.hasNext()) {
              paramName = (String) li.next();
              if (s.indexOf("#" + paramName + "#") > -1) {
                   s = new String(new StringBuffer(s).replace(s.indexOf("#" + paramName + "#"), s.indexOf("#" + paramName + "#") + (("#" + paramName + "#").length()), request.getParameter(paramName).toString()));
         return s;
    }What I am trying to do here is read in a line of text (String s) along with a the htpp servlet request. Put the names of the request paramaters into Vector v.
    Next I try to check the String s for any part of the String that matches one of the parameter names surrounded by #'s. If there is a match then I replace the #string# with the value associated with it in the http servlet request.
    The trouble is, my code on ly replaces the very first variable then stops, I cannot see why it does not do the rest.
    I hope this makes sense to somebody, becuase it doesn't to me :-)
    Thanks for any advise or help

    Yep. I have just done a basic one for testing. The String I read in is:
    username = #username#, action = #action#, email = #email#
    And the html form information that is sent to the servlet is:
    <input type="hidden" name="action" value="test">
    <input type="hidden" name="username" value="testuser">
    <input type="hidden" name="email" value="testemail">
    ....etc.
    I don't know if it makes a difference, I don;t think it does, but I am reading in a whole file, and passing the file line by line to this method.
    The method that passes each line is:
    public Vector generateHTML(HttpServletRequest request) {
         Vector v = new Vector();
         try {
              File f = new File("/fakepath/" + request.getParameter("action") + ".template");
              FileReader fr = new FileReader(f);
              BufferedReader br = new BufferedReader(fr);
              String s;
              while((s = br.readLine()) != null) {
                   s = replaceVariables(s, request);
                   v.add(s);
         } catch (Exception e) {
              // ignore
         } finally {
              return v;
    }

  • Can anyone help with string manipulation please?

    I am trying to change this string 43180-1-0001-37 into the following expression 43181-0001-37
    It is a string for Project No + Job Phase + Drawing No + Item No.
    The reduction of '43180' to '4318' is causing me the problem, I have the concatenation.
    Current report code is
    SELECT Os.[Orderno-o] As 'Order Number'
    ,Ph.PH_PHASE_NO + '.' + Re.REQUISITION_NUMBER As 'Req. Number'
    ,Pl.ID As 'Item ID'
    ,@CurrentProjectNumber + '-' + Ph.PH_PHASE_NO + '-' + Dr.DRAWING_NO + '-' + Cast(Pl.ITEM_NO As varchar(max)) As 'Drg & Item No.'
    It is this line giving me the problem?
    ,@CurrentProjectNumber + '-' + Ph.PH_PHASE_NO + '-' + Dr.DRAWING_NO + '-' + Cast(Pl.ITEM_NO As varchar(max)) As 'Drg & Item No.'

    Hi uh... Mr. Rubbish at SQL :)
    Unfortunately, there are many elements in your questions which aren't clear:
    1. What is the content in your columns PH_PHASE_NO, DRAWING_NO, ITEM_NO and what is their data type?
    2. What is the content of the variable @CurrentProjectNumber and what is its data type?
    3. It's unclear what is the logic behind the "reduction" of '43180' to '4318'. Do you want to remove trailing zeros? Shorten the value by one character? Because from what I see in your first sentence, it seems like you simply want to add 1 to '43180'
    and turn it into '43181'. That's a simple +1 operation. I also notice that you want to remove the "Job Phase" part from the string (which is "1" in your case)? Or do you need to add its value to the "Project No" (43180)? It's
    all quite confusing.
    Clarification would be highly appreciated.
    I would suggest, if you can, to please explain what you need NOT by specific examples, but by explaining your requirements IN GENERAL. In other words, don't use specific values like '43180', but start with a variable like 'X', and then let us know specifically
    what operation you want to perform on it (e.g. 'add 1' / 'remove trailing zeros' / 'shorten by one character' / 'add to it the value of some column' etc.). This will make it easier to understand the algorithm needed.
    Eitan Blumin; SQL Server Consultant - Madeira Data Solutions;

  • PAS string manipulation operations

    Hi
    How can I manipulate a string in PAS by replacing a character with another character?
    Thanks.

    Hi,
    Do you mean passing a string variable into a procedure or logic set?
    I think there is a "Text Variable" available in PAS which you can try using.
    Regards,
    Prasanth.

Maybe you are looking for

  • How to pass parameter value as "where [fieldname] = [fieldvalue]" in sql query under query type in SSRS report?

    I am having trouble with passing dynamic string to sql query for executing SSRS reports. I am using oracle database and I want to pass where clause parameter as "where LAND_NR = 6" to my select query. For example: I want to execute Select * from empl

  • How to Add Input Values into a XML in Flex AIR Application

    I need a help, now I am developing a flex windows AIR application, in this I am displaying data using a xml file, I have some input fields in my application,if the application user filled the input field and press submit button, the inputs Should be

  • Error in Travel Request for Non Payroll Relevant Employees

    While implementing Travel Management, we have employees who have their payroll areas as 01 (monthly) as well as 99 (non payroll relevant). We are implementing travel management for both types of employees so that they can create travel requests/expen

  • Safe to windows format my iPod?

    First a bit of bg info: I dont usually have windows xp, in fact I pretty much dont outside of school, and I dont even have computers class in school anymore so hey. My iPods firmware died, and after ages of googling, I found rockbox, an alternative,

  • Sapscript Translation

    Hi all, We made some changes to a sapscript form in its original languages (DE), now these changes are not visible in the other languages (something you would definitely find usual). We want to report all these changes to other languages, but we don’