Extract 2nd part of string

I have a desc field and I want to extract everything to the right of the hyphen.  Since you can't use substr in CR how can I do it?  Thanks so much in advance!

There are a few options:
1. Use Split to split on hyphens and then use the second element in the resulting array
2. Use inStr to find the location of the hyphen (inStr returns back the index of the desired character in the string being searched) and then use Mid to retrieve all text after that index
a programmer learning programming from perl is like a chemisty student learning the definition of "exothermic" with dynamite

Similar Messages

  • Extracting second  part of string

    hi
    i have a string like abcd~12341sdfs
    I have to extract the string after ~ symbol
    Please let me know how ot do it

    Your same question from last week Extracting a part of Strng.

  • Extracting a part of string

    I have a string like 'abcd1234'. I want to extract only the number part to another variable. I dont know the occurance of the number in the string
    Please help me

    Please read this thread:
    Re: Splitting numbers and alphabets

  • Extract a part of String

    Hi Experts!
        I have a database table in which there is a field 'TEXT' of data type 'STRING'.
        I need to pick up the value behind the field string.
    Field string has entry in this format:-
    <name1><Time-stamp1>## 'some comment' ## 'Some comment1' ##<name2><Time-stamp2>##'Some comment3'##
    ##-signifies the beginning of a new line.
        Now the problem is I need to pick only those values which are the latest, i.e 'some comment' & 'Some comment1'.
       or you can say the comment corresponding to the latest time stamp.
    Please suggest a way out.
    Help will be appreciated.
    Thanks in advance
    Regards
    Sourabh

    Hi
    Try this code:
    DATA: MY_STRING TYPE STRING.
    DATA: BEGIN OF T_COMMENT OCCURS 0,
            LINE(1000),
          END   OF T_COMMENT.
    DATA: LEN TYPE I.
    TEXT-001 is <name1><Time-stamp1>## 'some comment'
    ## 'Some comment1' ##<name2><Time-stamp2>##'Some
    comment3'##
    MOVE TEXT-001 TO MY_STRING.
    SPLIT MY_STRING AT '##' INTO TABLE T_COMMENT.
    LOOP AT T_COMMENT.
      CONDENSE T_COMMENT.
    Check if the first character is '
      IF T_COMMENT-LINE(1) = ''''.
    *...if yes the line is a comment, so write the comment
        LEN = STRLEN( T_COMMENT-LINE ) - 2.
        WRITE: / T_COMMENT-LINE+1(LEN).
      ENDIF.
    ENDLOOP.
    Max

  • String function in Oracle 9i to find part of string having two positions

    Hi,
    We need to extract the part of string having start and end position.
    Like
    Suppose the string is "TYPE ref_cur_type IS REF CURSOR" and need to extract name of the ref cursor i.e ref_cur_type.The length of the output is not fixed. But not able to extract the exact string.
    Thanks,

    What is the criteria for part of string? Do you give start character and end character position like 3,9 etc? Or its just that the word that comes between two spaces?
    Cheers
    Sarma.

  • How Can I extract each part of a string ??

    Dear Sir:
    I have a string like following to connect to Oracle Database:
    JDBC_URL= jdbc:oracle:thin:@localhost:1521:ABChere,
    I have Variables like:
    driverClass="";
    Hostname = "";
    port = "";
    SID="";
    etc
    I try to extract each part from this JDBC_URL,
    then assign them to following variable separately:
    driverClass="jdbc:oracle:thin";
    Hostname = "localhost";
    port = "1521";
    SID="ABC";
    Can some guru help give some good example and show how to do it??
    Thanks and have a nice weekends.

    try using a regular expression (regex).
    here, i am going to try to freeball it:
    // JDBC_URL= jdbc:oracle:thin:@localhost:1521:ABC
    Pattern p = Pattern.compile("(JDBC_URL)(\\s*)(=)(\\s*)(.*?:.*?:.*?)(:)(@)(.*?)(:)(.*?)(:)(.*?)")
    Matcher m = p.matcher(text)
    if(m.matches()) or if(m.lookingAt()){
    String driverclass = m.group(5);
    String hostname = m.group(8);
    ...group(10);
    ...group(12);
    }note that (\\s*) means "any amount of whitespace" and (.*?) means "any amount of any character (reluctantly)".
    i used that because i dont know the constraints on those values. for only numbers you can use (\\d+) etc
    [http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html|http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html]
    also, i put everything into ( ) - which is called a capture group - but that was just to make it clearer. in your final regex you may get
    rid of most of those.

  • Extract a part from a txt file

    Hi, I've a simple problem which unfortunately can not solve.
    I have some txt's that I want only to extract a part o them. (The first 100 characters). Here is my code:
    import java.io.*;
    public class ReadSource {
         public static void main(String[] arguments) {
            try {
              FileReader file = new FileReader("1.txt");
              BufferedReader buff = new BufferedReader(file);
               boolean eof = false;
               while (!eof) {
                    String line = buff.readLine();
                    if (line == null)
                        eof = true;
                     else{
                     int start = line.indexOf("something");
                     int end = line.indexOf("something_else");
                     String str2 = line.substring(start, end);
                      System.out.println(str2);
                buff.close();
            } catch (IOException e) {
                System.out.println("Error -- " + e.toString());
    }and the error tha java displays is:
    java.lang.StringIndexOutOfBoundsException: String index out of range: -1
         at java.lang.String.substring(String.java:1438)
         at ReadSource.main(ReadSource.java:21)
    Exception in thread "main"

    Tim I'm very sorry but is still don't work. It still display the same error.
    Look at my code
    import java.io.*;
    public class ReadSource {
         public static void main(String[] arguments) {
           try {
                   BufferedReader reader = new BufferedReader(new FileReader("1.txt"));
                   BufferedWriter writer = new BufferedWriter(new StringWriter());
                   String line = null;
                   while ((line = reader.readLine()) != null) {
                       writer.write(line);
                       writer.newLine();
                   String content = writer.toString();
                   // Now you have the whole file content into the content String
                   int start = content.indexOf("smth");
                   int end = content.indexOf("smth2");
                   String str2 = content.substring(start,end);
                   System.out.println("start = "+start+", end = "+end);
                   System.out.println(str2);
               reader.close();
         }catch (IOException e) {
                System.out.println("Error -- " + e.toString());
    }It looks very logical, I don't know what happens
    Thank you very much for your help.
    Kostas

  • How to extract local part from email address

    Hello, dear Colleagues.
    Please, help to extract local part from email address.
    Input string: "From: [email protected]"
    Need to get output string between "space" and "@": "C.Norris"
    Thanks.

    Thanks you, mjolinor.
    It works. 
    Could you show me please how to do the same with regular expression?
    Using -replace:
    $InputString = "From: [email protected]"
    $InputString -replace 'From: (.+?)@.+','$1'
    C.Norris
    Using -match:
    $InputString -match 'From: (.+?)@.+' > $null
    $Matches[1]
    C.Norris
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • Part of  string

    [email protected]; [email protected],
    if I only want first part of string, I meant before ;
    is that split is the only way to handle this case?

    using split is the easiest way.
    use something like this
    &test = "[email protected];[email protected]";
    &array = Split(&test, ";");
    for &i = 1 to &array.Len
    &email = &array[&i];
    /* Do some processing */
    end-for;
    if you do not want to use split try using the following
    &string = "[email protected];[email protected];[email protected];";
    While Find(";", &string) != 0
    &pos = Find(";", &string);
    &email = Substring(&string, 1, &pos - 1);
    &string = Substring(&string, &pos + 1, Len(&string) - &pos);
    End-While;
    Really, there are a lot of different possibilities of achieving what you want ...
    Edited by: Hakan Biroglu on Jul 10, 2012 4:15 PM

  • To show the 2nd part highlighted there only once on each page

    Hi,
    Could you pls see this for the problem?
    http://www.4shared.com/document/VExaTDlv/t31.html
    Regards,
    edward

    Hi,
    The 1st highlighted part below should be Group 1 in the report.
    The 3rd highlighted part should be Group 2.
    Without using a subreport for showing the 3rd part below, is there still a way to show the 2nd part highlighted below only once in each page?
    what is the 2nd part the column headings?
    what do you mean highlighted?

  • What for? (2nd part global declaration in transformation)

    Hi Experts,
    does anybody know, what for is the 2nd part global declaration in a routine of a transformation?
    Myself I'm a developer, so I can differ between global and local declaration in a class-definition. But the second possibility to declare variables is outside of class-definition and class-implementation.
    I checked start routine, end routine and character/ keyfigure routine. I can see both of the declaration. Does it makes any sence to use this declaration?
    $$ begin of global - insert your declaration only below this line  -
        ... "insert your code here
    $$ end of global - insert your declaration only before this line   -
    $$ begin of 2nd part global - insert your code only below this line  *
    ... "insert your code here
    $$ end of 2nd part global - insert your code only before this line   *
    Thanks in advance.
    Greets Nico

    Hi Lijo,
    first, thank you for you answer.
    I'm not sure if I got it.
    If you want to use a global variable for all packages that will be processed, I have to declare a CLASS-DATA. That means the instance of the class won't be deleted the whole data package.
    If I want to use a global variable that will be used in character/ keyfigure routine it's sufficient to declare DATA in 1st or 2nd part of declaration.
    I understand it in a way, that the second declaration part is redundant. Is it right?
    Thanks in advance.
    Greets Nico

  • What is diff between Global and 2nd Part Global Data in Transformation

    Hi,
    Does anyone know what the difference between declaring global data in the 'begin of global' data area in the class declaration and the 'begin of 2nd part global' area outside the class...endclass in ABAP routines in a transformation??
    Thanks,
    Mark

    Hello,
    In the first global part you can write your declaration or code you want to be able to reach globally
    in the tranformation. The 2nd global part will be used for those transformations which are migrated from an update or transfer rule. Routines used there will be automaticaly generated into the 2nd global part.
    Best Regards,
    Paula Csete

  • How to use the image manipulation palette to extract a part of an image

    How to use the image manipulation palette to extract a part of an image?I have a parent image from which i need to extract a certain sub part.can somebody pls help me on how to use this particular tool?
    Thanks

    Use the above snippet. You might need to convert the Image Type you are using with picture functions. The above snippet will give you good idea on how to achieve what you intend to.
    -FraggerFox!
    Certified LabVIEW Architect, Certified TestStand Developer
    "What you think today is what you live tomorrow"

  • Extract the numbers in string using regex

    Hi,
    How to extract the numers in string using regex?.
    Already i tried split up the string using [\\s]
    For ex: "Uting Tatk and Window Panet 15"
    it gives the ans 15.
    if the string is
    For ex: "Uting Tatk and Window Panet 15 New!"
    i can't find the number.
    so plz give me some idea to get the number frm String.
    Thanks

    I am developing a java project to extract Table of
    content in a particular
    PDF.
    i extracted all topics.
    then i want 2 extract page number from dat extracted
    TOC.
    if the TOC ends with number then i can easily find
    out the number
    but in vain if the TOC ends with like this
    "Uting Tatk and Window Panet 15 New!".
    i could n't find the page number.What will you do if it says:
    "15 ways to find topics 42 new"

  • TS1424 I keep getting an "err: 100000" while trying to download the 2nd part of an audiobook (all other 6 parts downloaded normally). What do I do?

    I keep getting an "err: 100000" while trying to download the 2nd part of an audiobook (all other 6 parts downloaded normally). What do I do?

    I'd report the issue to the iTunes Store.
    Log in to the Store. Click on "Account" in your Quick Links. When you're in your Account information screen, go down to Purchase History and click "See all".
    Find the item that is not downloading properly. If you can't see "Report a Problem" next to the entry, click the "Report a problem" button. Now click the "Report a Problem" link next to the item.
    (Not entirely sure what happens after you click that link, but fingers crossed it should be relatively straightforward.)

Maybe you are looking for