How to get substring from a string?

For example, there is a string:
C-REVF-00003 0010 Development
how the program get the value '0010'?

Hi,
Use Split command.
Syntax
SPLIT <c> AT <del> INTO <c1>... <cn> INTO TABLE <itab>.
Searches the field <c> for the character <del> and places the partial fields before and after <del>
into the target fields <c1> … <cn>, or into a new line of the internal table <itab>.
Ex.
DATA: STRING(60),
P1(20) VALUE '++++++++++++++++++++',
P2(20) VALUE '++++++++++++++++++++',
P3(20) VALUE '++++++++++++++++++++',
P4(20) VALUE '++++++++++++++++++++',
DEL(3) VALUE '***'.
STRING = ' Part 1 *** Part 2 *** Part 3 *** Part 4 *** Part 5'.
WRITE STRING.
SPLIT STRING AT DEL INTO P1 P2 P3 P4.
WRITE / P1.
WRITE / P2.
WRITE / P3.
WRITE / P4.
The output appears as follows:
Part 1 *** Part 2 *** Part 3 *** Part 4 *** Part 5
Part 1
Part 2
Part 3
Part 4 *** Part 5
Regards,
Bhaskar

Similar Messages

  • How to get substring from string using index?

    hi,
    here i am having string ,
    i want the pullareddy from below line ,
    i know how to get from substring.
    but i want to get the above using "index",
    can any help how to do it?
    String str1="janapana,pullareddy, in malaysia";
    jpullareddy

    get the start index with indexAt("pullareddy")
    get the end index with adding the length of the word to the start
    get the char[] of str1 with toCharArray()
    make a new string with the chars from start to end index.

  • How to get separators from a string

    I need to find the thousand separator, hundred separator and decimal separator from a string. I need to check which separator is available in a string ie., thousand or hundred separator. There may be a case where there is no separators.
    Please suggest me. I would be greatful if you provide me a code snippet.
    Thanks in advance...

    Hi Ananth,
    Try following:
    //For decimal fraction
    if (Count(Split(StrReverse(ToText ({OINV.DocTotal})), '.') ) > 1) then "With Decimal" else "Without Decimal"
    //For Units
    //Convert numbers to string valule
    //Reverse the string so that you cold parse them accordingly in units, hundreds, thousands etc
    //and finally split and parse each comma
    if
        Length
            Split
                    (Split(StrReverse(ToText ({OINV.DocTotal})), '.')[2]) , ','
                )[1]
        ) <= 2
    ) Then "Hundreds"
    Else "Thousands"
    You can continue on length of each subscript in array for hundreds, thousands, millions...
    Cheers,
    Kashif Ali

  • How to get substring from string starting from the end of string

    Hi
    How to cut from string:
    $A=C:\ClusterStorage\Volume1\WXP-plwropc300\Virtual Hard Disks\WXP-PLWROPC300_EE20E00F-315E-4781-A6DE-68497D4189B8.avhdx
    this substring (name of VHD file): WXP-PLWROPC300_EE20E00F-315E-4781-A6DE-68497D4189B8.avhdx
    This script should be universal so the best way to be cut all leters from the end of string $A till get the first mark \
    Thank you for help.
    Tomasz
    Kind Regards Tomasz

    PS > Split-Path 'C:\ClusterStorage\Volume1\WXP-plwropc300\Virtual Hard Disks\WXP-PLWROPC300_EE20E00F-315E-4781
    -A6DE-68497D4189B8.avhdx' -leaf
    WXP-PLWROPC300_EE20E00F-315E-4781-A6DE-68497D4189B8.avhdx
    PS >
    That is what "Split-Path" is for:
    ¯\_(ツ)_/¯

  • How to extract substring from a string based on the condition ??

    Hi,
    I'm having a very large string which as below
    EQD+CN+SAMPLE18767+2200+++5'
    NAD+CA+FIR:172:20'
    DGS+IMD+3.2+2346+55:CEL'
    FTX+AAA+++GOOD'
    FTX+AAA+++ONE'
    EQD+CN+SAMPLE18795+2200+++5'
    NAD+CA+TIR:172:20'
    DGS+IMD+3.2+2346+55:CEL'
    FTX+AAA+++SECOND'
    FTX+AAA+++IS FAIR'
    similarly FTX+AAA as above and it goes on
    i tokenized each segment with delimiter as ' and able to read each segment.
    Now i want to concatenate the FTX+AAA in a single segment if more than one FTX+AAA with IMMEDIATE below
    The output is as follows
    EQD+CN+SAMPLE18767+2200+++5'
    NAD+CA+FIR:172:20'
    DGS+IMD+3.2+2346+55:CEL'
    FTX+AAA+++GOOD,ONE'
    EQD+CN+SAMPLE18795+2200+++5'
    NAD+CA+TIR:172:20'
    DGS+IMD+3.2+2346+55:CEL'
    FTX+AAA+++SECOND,IS FAIR'
    similarly FTX+AAA should be concatenated if it has similar FTX+AAA IMMEDIATE below.
    The FTX+AAA segments can come any number of times immediate below
    Please help me how we can do this??? Can anyone help me with the code snippet to do this?
    Thanks,
    Kathir

    Encephalopathic wrote:
    You've posted > 300 times here and you still don't respect the rule regarding notification of all cross-posts? [http://www.java-forums.org/advanced-java/30061-how-extract-substring-string-based-condition.html]
    Do you think this this will help convince others to help you?See also [http://www.coderanch.com/t/500088/java/java/extract-substring-string-based-condition|http://www.coderanch.com/t/500088/java/java/extract-substring-string-based-condition].

  • How to get pattern from the string?

    Friends,
    I have 3 strings variables.
    Name1,Name2 and Name 3.
    I want to search following terms in above variables.
    'T1' 'TURC1' 'TURC 1' and 'TURC 1X'  " X=any character
    'T2' 'TURC1' 'TURC 2' and 'TURC 2X'  " X=any character
    'T3' 'TURC1' 'TURC 3' and 'TURC 3X'  " X=any character
    'T4' 'TURC1' 'TURC 4' and 'TURC 4X'  " X=any character
    If T1      found, then v_res = 1.
    If TURC1   found, then v_res = 1.
    If TURC 1  found, then v_res = 1.
    If TURC1X  found, then v_res = 1X.
    Same for 2 3 and 4.
    So, How can I do this?

    Hi,
        Try below code
    Do for remaining same Strings
    DATA : name1 TYPE string,
           name11 TYPE string,
           name2 TYPE string,
           name3 TYPE string.
    DATA : v_res(2) TYPE n,
           w_fdpos TYPE sy-fdpos,
           str TYPE i,
           ch TYPE c.
    name1 = 'ABCT1XRYTURC1JJTURC 1LLTURC 1A'.
    str = STRLEN( name1 ).
    FIND 'T1' IN name1.
    IF sy-subrc = 0.
      v_res = 1.
      FIND 'TURC1' IN name1.
      IF sy-subrc = 0.
        v_res = 1.
        SEARCH name1 FOR 'TURC 1'.
        IF sy-subrc = 0.
          v_res = 1.
          w_fdpos = syst-fdpos.
          w_fdpos = w_fdpos + 6.
          str = str - w_fdpos.
          name11 = name1+w_fdpos(str).
          SEARCH name11 FOR 'TURC 1'.
          IF sy-subrc = 0.
            CLEAR w_fdpos.
            w_fdpos = sy-fdpos.
            w_fdpos = w_fdpos + 6.
            ch = name11+w_fdpos(1).
            CONCATENATE '1' ch INTO v_res.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.
    FIND 'T2' IN name1.
    IF sy-subrc = 0.
      v_res = 1.
      FIND 'TURC2' IN name1.
      IF sy-subrc = 0.
        v_res = 1.
        SEARCH name1 FOR 'TURC 2'.
        IF sy-subrc = 0.
          v_res = 1.
          w_fdpos = syst-fdpos.
          w_fdpos = w_fdpos + 6.
          str = str - w_fdpos.
          name11 = name1+w_fdpos(str).
          SEARCH name11 FOR 'TURC 2'.
          IF sy-subrc = 0.
            CLEAR w_fdpos.
            w_fdpos = sy-fdpos.
            w_fdpos = w_fdpos + 6.
            ch = name11+w_fdpos(1).
            CONCATENATE '1' ch INTO v_res.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.
    FIND 'T3' IN name1.
    IF sy-subrc = 0.
      v_res = 1.
      FIND 'TURC3' IN name1.
      IF sy-subrc = 0.
        v_res = 1.
        SEARCH name1 FOR 'TURC 3'.
        IF sy-subrc = 0.
          v_res = 1.
          w_fdpos = syst-fdpos.
          w_fdpos = w_fdpos + 6.
          str = str - w_fdpos.
          name11 = name1+w_fdpos(str).
          SEARCH name11 FOR 'TURC 3'.
          IF sy-subrc = 0.
            CLEAR w_fdpos.
            w_fdpos = sy-fdpos.
            w_fdpos = w_fdpos + 6.
            ch = name11+w_fdpos(1).
            CONCATENATE '1' ch INTO v_res.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.
    FIND 'T4' IN name1.
    IF sy-subrc = 0.
      v_res = 1.
      FIND 'TURC4' IN name1.
      IF sy-subrc = 0.
        v_res = 1.
        SEARCH name1 FOR 'TURC 4'.
        IF sy-subrc = 0.
          v_res = 1.
          w_fdpos = syst-fdpos.
          w_fdpos = w_fdpos + 6.
          str = str - w_fdpos.
          name11 = name1+w_fdpos(str).
          SEARCH name11 FOR 'TURC 4'.
          IF sy-subrc = 0.
            CLEAR w_fdpos.
            w_fdpos = sy-fdpos.
            w_fdpos = w_fdpos + 6.
            ch = name11+w_fdpos(1).
            CONCATENATE '1' ch INTO v_res.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.
    Regards
    Bala Krishna

  • How to get CLOB from stored procedure via StoredProcedureCall

    hi all
    I got "sp" on server : procedure get_text(p_in in varchar2, o_list out clob);
    in code:
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("get_text");
    call.addNamedArgumentValue("p_in", new String("MyList"));
    call.addNamedOutputArgument("o_list"); // <- out CLOB
    Vector v = (Vector)this.m_UnitOfWorkt.executeSelectingCall( call ); // <- here I got error
    but if o_list is varchar is all ok
    so how to get data from clob?
    Please help
    Regards
    Krzysztof

    Post Author: achaithanya
    CA Forum: Data Connectivity and SQL
    I'm connecting to database through stored procedure only.We have sybase installed on our local system so that we are given permissions only to access the stored procedures.When u see the fields in CR XI i.e Field explorer you are able to see only 1st result fileds.I connected to sybase and there i'm able to see the output of 1st & 2nd Result set.
    Regards,
    Chaithanya.

  • How to get coordinates from Google Map

    I wonder how to get coordinates from Google Map to JavaFX application when click has occured. Here is an example of code:
    public class JavaFXApplication extends Application {
    public void showCoordinates(String coords)
            System.out.println("Coordinates: " + coords);
        @Override public void start(Stage stage)
            final WebView webView = new WebView();
            final WebEngine webEngine = webView.getEngine();
            webEngine.load(getClass().getResource("googlemap.html").toString());
            webEngine.getLoadWorker().stateProperty().addListener(
                    new ChangeListener<State>() {
                        @Override
                        public void changed(ObservableValue<? extends State> ov, State oldState, State newState) {
                            if (newState == State.SUCCEEDED) {
                                JSObject window = (JSObject) webEngine.executeScript("window");
                                window.setMember("java", new JavaFXApplication());
            BorderPane root = new BorderPane();
            root.setCenter(webView);
            stage.setTitle("Google maps");
            Scene scene = new Scene(root,1000,700, Color.web("#666970"));
            stage.setScene(scene);
            stage.show();
       public static void main(String[] args){
            Application.launch(args);
    // googlemap.html file
    <!DOCTYPE html>
    <html>
        <head>
            <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
            <style type="text/css">
                html { height: 100% }
                body { height: 100%; margin: 0px; padding: 0px }
                #map_canvas { height: 100%; background-color: #666970; }
            </style>       
            <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false">
            </script>
            <script type="text/javascript">           
                function initialize() {
                    var latlng = new google.maps.LatLng(40.75089, -73.93804);
                    var myOptions = {
                        zoom: 10,
                        center: latlng,
                        mapTypeId: google.maps.MapTypeId.ROADMAP,
                        mapTypeControl: false,
                        panControl: true,
                        navigationControl: true,
                        streetViewControl: false,
                        backgroundColor: "#666970"
                    var map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);    
                    document.map = map;
            google.maps.event.addListener(map, 'click', function(event) {
                //java.showCoordinates(event.latLng); ???
            map.setCenter(location);
            </script>
        </head>
        <body onload="initialize()">
            <div id="map_canvas" style="width:100%; height:100%"></div>
        </body>
    </html>Edited by: krbltik on 03.10.2012 22:59

    Hi, welcome!
    You may also have a look at GPS Info Qt, available for free at Ovi Store: http://store.ovi.com/content/165671
    GPS Info Qt is a nice Qt app. I have it on my C6-01 and I like it.
    Regards.

  • How to get Text from (.txt) file to display in the JTextArea ?

    How to get Text from (.txt) file to display in the JTextArea ?
    is there any code please tell me i am begginer and trying to get data from a text file to display in the JTextArea /... please help...

    public static void readText() {
      try {
        File testFile = new File(WorkingDirectory + "ctrlFile.txt");
        if (testFile.exists()){
          BufferedReader br = new BufferedReader(new FileReader("ctrlFile.txt"));
          String s = br.readLine();
          while (s != null)  {
            System.out.println(s);
            s = br.readLine();
          br.close();
      catch (IOException ex){ex.printStackTrace();}
    }rykk

  • Cut Substring from a string

    Hi!
    I have a question
    Can i cut a substring from a string?
    If yes how is possible?
    Can you help me with an example?
    Thanks

    Hi!
    I have a question
    Can i cut a substring from a string?Yes
    If yes how is possible?You shoould read the API for String, there is a method called substring
    Can you help me with an example?You wont need one if you read the API

  • How to get photos from mac to iPhone 6? when i try it just comes up iCloud instead of my photos

    how to get photos from mac to iPhone 6? when i try it just comes up iCloud instead of my photos

    Make sure Settings > iCloud > Photos > iCloud Photo Library (Beta) = "Off"
    Then sync your iPhone using iTunes and make sure your sync settings for photos are set correctly in iTunes.

  • I got a new computer and don't know how to get music from ipod touch to itunes library

    I recently got a new computer and don't know how to get music from my ipod touch to show on my itunes library. 

    You need to transfer the iTunes folder from the old computer to the new one.
    iTunes: How to move your music to a new computer (Mac or Windows):
      http://support.apple.com/kb/HT4527

  • I have a new MacAir and don't know how to get info from my USB stick and my SD photo card.  Can anyone help me please?

    I have a new MacBook Air and don't know how to get info from my USB stick and get info from my SD card.  Can anyone help, please?

    Plug the stick and/or card into the appropriate slots on the side of your Air. Do you see icons for the devices appear on the desktop? Click into them to see what files are there.
    Matt

  • How to get data from a USB-UIRT device using Labview?

    How to get data from a USB-UIRT device using Labview?
    I'm trying to get data from a USB-UIRT device, is it posible with Labview?
    I really appreciate your help, 
    thanks

    You may want to contact the developer of the device for the API and DLL.
    http://65.36.202.170/phpBB2/viewforum.php?f=3

  • How to get file from server while click on link

    Hi,
    i created on link and i gave one server path to select file from server but while clickinng on link it no displaying any thing.
    following is the Destination url that i gave for the item.
    /u08/app/appvis/xxex/inst/xxex_apps/xxrbe/logs/appl/conc/log/
    please tell me how to get file from server while click on link.

    Ok I got your requirement now.
    If you are getting file names from view attribute then you should not be adding destination URI property for the link.
    Instead you can use OADataBoundValueViewObject API.
    Try below code in your controller processRequest method:
    I am assuming that you are using classic table.
    Also in below example it considers OAMessageStyleText and you can replace it with link item if you want.
    OATableBean tableBean =
    (OATableBean)webBean.findChildRecursive("<table item id>");
    OAMessageStyledTextBean m= (OAMessageStyledTextBean)tableBean.findChildRecursive("<message styled text in table item id>");
    OADataBoundValueViewObject tip1 = new OADataBoundValueViewObject(m, "/u08/app/appvis/xxex/inst/xxex_apps/xxrbe/logs/appl/conc/log/"+"<vo attr name which stores file name for each row>");
    m.setAttributeValue(oracle.cabo.ui.UIConstants.DESTINATION_ATTR, tip1);
    Regards,
    Sandeep M.

Maybe you are looking for

  • PDF files won't open in Safari

    I'm not sure when this happened but it seems recently...when I go to sites which have pdf files attached (e.g. Yamaha electonics/support/user manuals)the pdf files no longer load within Safari nor download to be opened in their own window. I have Ado

  • Batch Job Processing

    Hi, I have 2 selection screens.i have entered the data in 1st screen and press 'F8',now i wil be getting 2nd screen.In this i have to select the check boxes.once i checked this check boxes that could be saved automatically. Can any one please suggest

  • Cannot launch "transport monitor"... what is this?

    I just got back from a crash but I think I've been lucky. I booted up from my Tiger startup disc, did an archive and install and I think everything is pretty much ok. I do get one red flag when i log in though and I cannot find any online information

  • Beta 9.2 - WLP patch available

    All - A WLP patch is available to the Beta 9.2 installer. The patch addresses a couple of key issues. To download the patch, start here: http://commerce.bea.com/showproduct.jsp?family=WLPORTAL&major=9.2&minor=-1&DL=www_WL-Portal-Beta_icon, and be sur

  • When deleting a user created folder from On My Mac in Mac Mail the sent messages that are part of conversations that reside there are not deleted, only the received mail gets deleted.

    When deleting a user created folder from On My Mac in Mac Mail the sent messages that are part of conversations that reside there are not deleted, only the received mail gets deleted. Any way for both the received and sent mail that resides there to