Regarding the lenght of the string?

hai friends,
   can any one tell me how to find the length of the string..?
ex: data x type string
x = 9989.
where now length of x is 4.
so how can i  find what is the length of the string,..?
regards
satish.v

Define another variable type I
DATA:v_length type i.
v_length = strlen( X ).
That will give you the length of the string.
Reward poin ts if sueful.
Regards,
Nageswar

Similar Messages

  • Regarding the string

    Hi All,
    I have a string with 9 character.
    Now I need to delete the 5th character and make it into 8 character string.
    Can u plz tel me the exact procedure?
    Thank u and Best Regards,
    Rohit

    Hi,
    Try in this way
    DATA: value1 TYPE string VALUE 'abcdefghi',
               value2 TYPE string.
    CONCATENATE value1+0(4) value1+5(4) INTO value2.
    WRITE value2.
    Cheers,
    Kothand

  • Help regarding parsing the string

    I wanted to display diffrent colored strings in the Textarea which is not possible. But from somewhere I came to know that it is possible by parsing the strings comming frm various sources and then display them with diffrent colors. can anyone help me out regarding this. The format is something like:
    &x100100100This is a colored string!&n
    the &x100100100 means that the text after it should use RGB value of 100,100,100. &n meant that the colors should stop and return to default.
    Well... this makes the client need to parse strings and set colors etc
    Can anyone explain me with some small code without using the swing class. thanks in advance.

    Here is my code I am trying to do...Pls see to it and tell me the mistake....
    import java.net.*;
    import java.applet.*;
    import java.awt.*;
    import java.io.*;
    import java.awt.event.*;
    import java.util.*;
    import java.lang.*;
    public class client extends Applet
         //implements KeyListener
              TextArea display;
              //TextField send;
              TextArea send;
              Label status;
              Color color;
              mypanel p1;
              boolean connected=false;
              private Socket sock;
               protected BufferedReader instream;
              private DataOutputStream out;
              private String IP;
              private int port;
              Thread reader;
              private String fontName;
              private int fontSize;
              private String company;
              private String userName;
              private String userID;
              private String compName;
         public void start()
                   String param;
                   String mStr ;
                   IP=getParameter("IP");
                   userID=getParameter("userID");
                   userName=getParameter("userName");
                   fontName=getParameter("fontName");
                   company=getParameter("company");
                   mStr=userID+"#"+userName+"#US#"+company+"#1#A";
                   param=getParameter("fontSize");
                   try{
                        if (param!=null)
                             fontSize=Integer.parseInt(param);
                        else
                             fontSize=0;
                        } catch (NumberFormatException e){
                             fontSize=-1;                    
                   param=getParameter("port");
                   try{
                        if (param!=null)
                             port=Integer.parseInt(param);
                        else
                             port=2;
                        } catch (NumberFormatException e){
                             port=-1;     
                        //display.append(sock.getURL());
                        connect(IP,port,mStr);
         public void init()
                   setBackground(Color.white);
                   //color = new Color(221,240,255);
                   setForeground(Color.black);
                   p1=new mypanel();
                   add(p1);
                   reader = new readMessage(this);
                reader.setPriority(1);
                   //send.addKeyListener(this);
         public void paint(Graphics g){
              String s;
              double p;
              int i;
              //status.setBackground(Color.blue);
              g.setColor(color);
              display.setEditable(false);
              status.setForeground(Color.black);
              display.setBackground(Color.white);
              p1.cmdSend.setBackground(Color.white);
              p1.cmdSend.setForeground(Color.black);
              display.setFont(new Font("Arial", Font.PLAIN, 11));
              //status.setBackground(Color.blue);
              display.setForeground(Color.blue);
         public void connect(String host,int p,String mStr)
               try{
                   sock=new Socket(host,p);
                   instream = new BufferedReader( new InputStreamReader(sock.getInputStream()));
                   out = new DataOutputStream(new BufferedOutputStream(sock.getOutputStream()));
                   out.writeBytes(mStr);
                   connected=true;
                   out.flush();
                   reader.start();
                   setStatus("You are Connected Successfully. ");
                   display.append("Welcome to "+company+" chat . A Customer Support Executive will assist you shortly.\n");
                   catch (UnknownHostException a) {
                             connected=false;
                             p1.cmdSend.setEnabled(false);
                             send.setEditable(false);
                             display.append(company+" live support service fails due to some technical reason.");
                            //status.setText("Intelecorp Live Suport service fails due to some technical reasions.");
                   catch (IOException b) {
                             connected=false;
                             p1.cmdSend.setEnabled(false);
                             send.setEditable(false);
                             display.append(company+" live support service fails due to some technical reason.");
                            //status.setText("Intelecorp Live Suport service fails due to some technical reasions.");
                   catch (SecurityException c ) {
                        connected = false;
                        display.append("Error");
              public void setStatus(String mstr)
                   status.setText(mstr);
              public boolean action (Event e, Object arg)
                   if(e.target instanceof Button)
                        if (e.target==p1.cmdSend)
                             sendMessage(send.getText());
                             send.setText("");
                             return true;
                   return false;
    public boolean keyUp(Event e, int key)
            if(key==Event.ENTER)
                   sendMessage(send.getText());
                  send.setText("");
                   return true;
            return false;
         public void keyPressed(KeyEvent e)
              switch (e.getKeyCode()) {
                   case KeyEvent.VK_ENTER:
                        sendMessage(send.getText());
                        send.setText("");
                        break;
                   default:
                        break;
              return ;
         public void keyReleased(KeyEvent e) {} ;
         public void keyTyped(KeyEvent e) {} ;
         public void sendMessage(String mStr)
                   int mflag;
                   try{
                        mflag=mStr.lastIndexOf('\n');
                        mStr.trim();
                        if ((connected==true) && (mStr.length()>0))
                             if (mflag<0)
                                  mStr=mStr+"\n";
                             display.append(userName+" : "+"&x100100100"+mStr+"!&n");
                             out.writeBytes(mStr);
                             out.flush();
                             send.setText("");
                   }catch (IOException e){
                             connected=false;
                             p1.cmdSend.setEnabled(false);
                             send.setEditable(false);
                             display.append("Unable to send the message, you may be disconnected from the server.");
                             //status.setText("Unable to send the message, you may disconnected from the server.");
    public void destroy(){
              try{
                   sock.close();
                   }catch (IOException e){
                             status.setText(e.toString());
    class readMessage extends Thread{
              client mClient;
              private String mStr;
             public readMessage(client c){
                        super("Client Reader");
                        this.mClient = c;
    public void run()
              mStr=null;
         try{
                        if (connected==true)
                             while(true)
                               mStr = instream.readLine();
                               display.append("&x200200200"+mStr+"!&n"+"\n");
                               //display.setText(display.getText()+"\n"+mStr);
                                    if (mStr==null)
                                  break;
              }catch (IOException e){
                             connected=false;
                             p1.cmdSend.setEnabled(false);
                             send.setEditable(false);
                             display.append("Unable to read the messages, you may be disconnected from the server.");
                             //status.setText("Unable to read the messages, you may disconnected from the server.");
    class mypanel extends Panel 
                   Label l1,l2,l3;
                   Button cmdSend;
                   mypanel()
                        setLayout(new BorderLayout());
                        add("North",display=new TextArea("",12,50,TextArea.SCROLLBARS_VERTICAL_ONLY));
                        add("West",send=new TextArea("",2,50,TextArea.SCROLLBARS_VERTICAL_ONLY));
                        //add("West",send=new TextField());
                        add("East",cmdSend=new Button("  Send  "));
                        add("South",status=new Label(""));
    }

  • How many bytes can the string

    Hi,
    I have the problem to create the String with the lenght longer than 2 MBytes.
    For instance :
    byte[] b = new byte[10*1024*1024);
    len = b.length;
    String s = new String(b,0,len);
    Any helps are appreciated.
    PS: Pls assume b contains a data e.g. 7*1024*1024 and has the length of 7*1024*1024, everthing is ok until the String can not be instanstiated.
    Regards
    Paulus

    I have the problem to create the String with the lenght longer than 2 MBytes.What do you mean - what kind of problem? This works just fine:public class test {
        public static void main(String args[]) {
            byte[] b = new byte[10 * 1024 * 1024];
            for (int j = 0; j < b.length; j++) {
                b[j] = 97;
            String s = new String(b) + "b";
            System.out.println(s);
    }(although running did require setting the max. heap size bigger... :)

  • How can I select a radio button in a table regarding the data in the cells?

    Hi everyone
    This is the issue: I need to select the RadioButton which is in a table with data related to transfers in the cells next to it, so I need to select the correct radio regarding the data next to it.
    This is the whole process: First I go to the Add Recurring Transfer section and select the parameters of the transfer (Accounts, date, amount, months etc), then with VB code I capture those parameters from the page and store them into Global variables for further usage on my E-tester script.
    Right after that I need to select the radiobutton regarding the data of the transfer that I already created in order to delete it or modify it (Please see Attachment selectradio1.jpg)
    So How can I move along the table and compare each cell with the variables that I created with the transfer information, so when I finish comparing a row cell by cell and if all the comparison match well in that row, I could select the radiobutton of the row.
    Note: Second Attachment selectradio2.jpg shows the source code of the table...If you need more info please let me know
    Could you please help me with this problem?? I'm Kind of frustrated with this issue jejeje

    Here is an example. I uploaded mock html so that you can actually try this code. I think this does exactly what you are asking.
    Private Sub RSWVBAPage_afterPlay()
    Dim tbl As HTMLTable
    Dim tblRow As HTMLTableRow
    Dim tblCell As HTMLTableCell
    Dim strValue As String
    Dim rButton As HTMLInputElement
    ' ******** This would be your global variable. I put this so that values are seperated by a semicolin you can use what ever format works for you.
    strValue = "03/22/2008;03/22/2008;*************1977;*************1977;$25.25;Jan, Jun, Jul, Dec"
    ' Strip out the ; for inner text comparison
    strValue = Replace(strValue, ";", "")
    ' This will get the table but can be modifoed to be more specific
    Set tbl = RSWApp.om.FindElement(, "TABLE")
    ' This loops through all the rows in the table until a match to the strValue is found
    ' then clicks the radio button. Findelements allows you to specify a root element
    ' once the correct root row is found, FindElemets can get the correct radio button
    For Each tblRow In tbl.rows
      If tblRow.innerText = strValue Then
        Set rButton = RSWApp.om.FindElement("account", "INPUT", "NAME", , , tblRow)
         rButton.click
       End If
    Next
    End Sub
    I also uploaded the script I created. You should be able to run it and see how it works.
    This should get you going.

  • Unable to capture the String[] from a JavaCallOut

    Hi all,
    I am doing an application in which I need to do a java callout which accepts string and return a String array as output. The java class alone is working fine but when I do the Java Callout and pass the string I am getting *"<con:java-content      ref="jcid:-31630335:136f3572827:-3925" xmlns:con="http://www.bea.com/wli/sb/context"/>"* as a response. How should I access array variable in OSB?
    Kindly help me in this.
    Regards
    Phanindra.

    in Java Callouts I would avoid types which are not in THE list of supported types:
    http://docs.oracle.com/cd/E13159_01/osb/docs10gr3/eclipsehelp/ui_ref.html#wp1290279
    java.lang.String[] is supported for INPUT ONLY
    just return some CSV in a String and you will be happy
    or return a XmlObject containing multiple elements
    A con:java-content thingie can be processed only in another Java callout, and not in a OSB message flow....

  • Seperation of contents in the string

    Hi Guru's,
    I was assigned a little bit query related to updation of text for LFA1 object. I would like to expalin my requirement in details. I have 2 texts like Z001 & Z002. Z001 stores range of PRO numbers. Z002 is for display the current PRO number related to perticular vendor. we need to update that Z002 by code it self. Suppose Z001 contains the range like this (ROADWAY 444 100 , ROADWAY 444 999). I need to update Z002 with the next value starting from lower value like
    (ROADWAY 444100,ROADWAY 444 101,ROADWAY 444 102...........). For each vendor length of PRO # may change. Now my problem is how can i seperate alphabates and numerics in this string (ROADWAY 444 100..) for updating Z002 with next PRO#. Kindly help me out in this scenario and your help will be greatly appriciated.
    Regards,
    Ravi.

    Hi Ravi,
    You can split the string into parts..
    DATA : begin of itab OCCURS 0,
                 line type char100,
    end of itab.
    SPLIT z001
         AT space
    INTO TABLE itab.
    Now if you are sure that the 3rd record will be which you need to use..
    Then, LOOP AT itab INDEX 3.
    MOVE itab-line TO w_num.
    w_num = w_num + 1.
    ENDLOOP.
    Thanks and Best Regards,
    Vikas Bittera.
    **Reward if useful**

  • Issue with the String return from com.sap.aii.af.mp.module.ModuleData

    Hi Friends,
    We are developing Adapter for XI using java, XI is giving String in the form of ModuleData, we r getting the String from ModuleData but in the logic we need to split the String in parts based on character '…', but I observed that in the communication channel symbol is showing as ' '.
    We have written the java code based on '…' but splitting is not working, then I tried with the following code
    String[] molecules = null;
    if(filedata.indexOf(" ") != -1){               molecules = filedata.split(" ");
    }else if(filedata.indexOf("?") != -1){
                    molecules = filedata.split("?");
    }else if(filedata.indexOf("…") != -1){
                    molecules = filedata.split("…");     
    Still it is not working, please help in case of ModuleData text splitting..
    Thanks in advance.
    Satinder Saini

    Check with a hex editor, what the  ' '. really is.
    Maybe it is a tab? Then you can use "\t" in a Java progam.
    See also here:
    http://en.wikipedia.org/wiki/ASCII#ASCII_control_characters
    Regards
    Stefan
    Edited by: Stefan Grube on Mar 26, 2008 2:22 PM

  • How to calculate length of the string in transformation file

    Hello all
    I have tried a number of ways and I am not able to calculate the length of the incoming field in transformation file for my data load. Here is the issue.
    I have an incoming string of length 10 and I need to use it to update multiple dimensions which will need first 2, 4 ,6 , 8 characters respectively.
    Now in transformation file ID=ID(1:2) works perfect. However, the BW InfoObject will have multiple values as shown below:
    ID
    Description
    AB
    Business
    ABCD
    Business Organization
    ABCDEF
    Business Line
    ABCDEFGH
    Product Family
    ABCDEFGHIJ
    Product Line
    ABCDEFGHIJKL
    Brand
    I want to update my dimension for Business Organization. I need to update only the records where the length of the incoming string is 4. If I do ID(1:4), I will get the duplicate records and will see the ID less than 4 characters in rejected records. The latter is not such a big issue but the former one is as I need to fetch the right description as well. The formula should check the length and then only pass the record else a dummy value.
    A formula to achieve this in the transformation file is what I am looking for.
    Regards
    Gajendra

    Thanks Vadim for the quick response!
    I am also trying something similar and really appreciate your input here. However, I am not sure if the conversion is really happening.
    Here is what I have done:
    But the strings <> 4 in length are still passing through.

  • Process Message failed: System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.

    Hi
    I am trying to process an X12 message and I am getting following error.
    Method : ProcessMessage
    Message : Process Message failed: System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
    Parameter name: length
       at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
       at Q.Inbound.X12Preprocessor.getTranTypeFromFuncCode()
       at Q.Inbound.X12Preprocessor.setProcessType()
       at Q.Inbound.X12Preprocessor.getFuncGroupHeader(StreamReader sr)
       at Q.Inbound.X12Preprocessor.ProcessMessage(X12Definition& docInfo)
    Please help.
    Thanks

    Might try them over here.
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=csharpgeneral%2Cvbgeneral%2Cvcgeneral&filter=alltypes&sort=lastpostdesc
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • Converting part of the string to a date and subtract with sysdate.

    HINT! In order solve this you must know how the pnr is assembled. Study this:
    650323-5510, we only need the first six characters. They inform us about when the person (car owner) was born. In this case it is 23 Mars 1965. You have to use several oracle built-in-functions to solve this. Hint! Begin by converting part of the string to a date and subtract with sysdate.
    select to_char(to_date(cast(pnr,'YYMMDDMM'))) from car_owner;
    please what am i doing wrong. i need the result to be something like this
    Hans, Rosenboll, 59,6 years.

    Hi.
    The main problem here is you have only last two digits of year. That could be the problem in a couple of years from now, when somebody born after 2k would get in to your database. For now if we ignore this problem the right solution would be :
    <code>
    SELECT months_between(trunc(SYSDATE),
    to_date('19' || substr('650323-5510',
    1,
    6),
    'YYYYMMDD')) / 12 years_old
    FROM dual
    </code>
    Suppose you are expecting the age of the car owner as a result above code will give you that. One again notice the '19' I appended.
    Best regards.

  • How to find the total length of the string drawed in a rect?

    Hello Everybody,
    I am drawing a string in on one rect using drawInRect method. This drawInRect method gives us a return value as size of the rect. I need length of the string that is did draw in that rect, but didn't find any api to do this.
    Can anyone tell me , how find the length of the string which we did draw in rect?
    Any help regarding this issue , is highly appreciable.
    Thanks,
    Pandit

    Hi Adreas,
    First of all, very thanks for the response.
    Actually , I am looking for other thing. Using drawInRect method I am drawing contentString in self.rect like below.
    //code
    [contentString drawInRect:self.rect withFont:[UIFont fontWithName:@"Verdana" size:14.0] lineBreakMode:UILineBreakModeWordWrap alignment:UITextAlignmentLeft];
    //End
    My contentString is much larger string, so I am not able to draw it in rect(length: 320.0 height: 460.0) completely. My rect is showing only a part of a contentString. So I need to get that part of string which did draw in the rect, so that I can process my contentString to get the remaining string to draw it a next rect.
    The above code statement is returning me the CGSIZE , it is giving the size of the rect but not giving any information of the string which get draw in that rect.Do you have any idea how to do this?
    Any information on this is highly appreciable.
    Thanks,
    Pandit

  • How to increase the string length of an uploaded file

    Hi,
    i use a abap webser where i've uploaded some JAR files into the mime repository.
    Unfortunately the string length is limited by 40 characters and so longer file names are cut.
    How can I increase the default string length? Does somebody know a workaround?
    Thanks.
    Edited by: Martin Gardyan on Oct 22, 2008 9:48 AM

    what i guess copying those jars should not create this problem.U just try in db using
    "ALTER TABLE <table_name> MODIFY <column_name> VARCHAR2(<new, larger length>)"
    may be it works.
    Regards,
    Anu

  • How to capture the string values

    Hi Gurus,
    Could you plz suggest me how to capture the string value.
    My requirement is.
    I have a structure field called  cnj_stat-sttxt_int and it is storing a value like "REL CDRT AVAC". AND the moddile value CDRT will change according to condtions. now i required to write a logic like if cnj_stat-sttxt_int field contain 'REL' and 'AVAC'.  I HAVE TO THROW SOME ERROR.
    SO please give some idea about on it...
    Its urgent..
    points will be rewarded...
    Thanks in advance!!!!
    Thanks & regards,
    Kranthi.

    if cnj_stat-sttxt_int field contain 'REL' and 'AVAC'. I HAVE TO THROW SOME ERROR.
    if cnj_stat-sttxt_int CS 'REL' and cnj_stat-sttxt_int CS 'AVAC'.
    THROW SOME ERROR.
    endif.

  • Where the string "failed" is created in steps in the main sequence to fill into Parameter.Result PostUUT in the NI teststand II courese example 4-1 Modifying callback.seq

    For PostUUT in  the NI teststand II  courese example 4-1 Modifying callback.seq, there are two steps, one is Test Passed,
    the other is Test Failed, both set each preconditions, for example, Parameters.Result.Status == "Failed"  in the test failed step, if the step failed in the main sequence,the string "failed " is filled into Parameters.Result.Status
     but I can't find where the string "failed" is created in steps in the main sequence. 
     Because I can't find any expression in any steps  to fill into Parameters.Result of  the test failed step in the PostUUT. 
    In fact, when running if step fails, the string "failed " is filled into Parameters.Result.Status 
     Would you please  explain for it ? 
    thanks,

    Hi,
    Look at the Sequential Model Sequence File, and either the sequence SinglePass of Test UUTs for the step that invokes the step Post UUT.
    Then look at the Parameter List for the SequenceCall for that step. you will find your answer.
    Regards
    Ray Farmer

Maybe you are looking for