Padding a string variable with blanks

I need to put one blank space in fromt of a string variable.
for instance an order number would be x192102 with x being a blank space.
Thanks

useString oldString = "192102";
String newString = " ";
newString = newString.concat(oldString);to be brief use:oldString = "192102";
oldString = " ".concat(oldString);

Similar Messages

  • String Manipulation with blank space at the end

    Hi All,
    DATA:  str1(999),
           a(10),
           b(10).
    DATA: len TYPE i.
    a = 'Welcome'.
    b = 'To all'.
    CONCATENATE a b INTO str1 RESPECTING BLANKS.
    len = STRLEN( str1 ).
    WRITE: len.
    result : 16.
    If I declared str1 as string result is 20. Because in above case empty space is truncated at last .
    So any otherway to getting result 20 with out declaring str1 as string.

    Hi vinoth ,
    To get spaces at last  ,
    data : str1 type char10 ,
             len type i .
    str1 = 'the ' .                  " space given by pressing space bar button
    len = STRLEN( str1 ).     " in len we get it as 3 , coz 'the ' is 3 only .
    str1 = 'the ' .                 " space given by pressing ALT 2 5 5
    len = STRLEN( str1 ).   " in len we get it as 4 , coz 'the ' is 3 and 1 space is given by pressing ALT 255 .
    This works,
    Hope it might be helpfull,
    Regards,
    Aby

  • Problems in Handling String Variables with Pro*C

    I have a Pro*C program that select one record from a table. Although I don't have any NULL values in this record, I got the following error:
    ORA-01405: fetched column value is NULL.
    This problem only accurs when I try to retrieve[b] characters. Everything works fine when I handle numbers.
    I also tried to use indicators with the output value from the query. Another error was returned:
    ORA-03106: fatal two-task communication protocol error.
    I am not sure wheather the problem is from my program or some configuration of the environment or the client.
    The database (Oracle 9i) is in a remote machine, and I am using Oracle Client (9i) in my machine running Tru64 OS.
    The code that I am using is as follows:
    EXEC SQL BEGIN DECLARE SECTION;
    int db_classId;
    char db_neId[101];
    EXEC SQL END DECLARE SECTION;
    EXEC SQL SELECT class_id, ne_id INTO :db_classId, :db_neId
    FROM NE_ROUTE WHERE ne_id like 'BA%';
    Can anyone help on this issue? Is it something to do with NLS_LANG parameter?
    I just want to note down that all queries work fine with SQL Plus

    Hi,
    I used different select statements as you suggested, but I still get the same error. I also changed the statement to make sure it doesn't return a NULL value.
    I tried the following cases
    1. EXEC SQL SELECT 'name' INTO :db_neId FROM DUAL;
    and I get >> ORA-01405: fetched column value is NULL.
    2. EXEC SQL SELECT NVL('name','name2') INTO :db_neId FROM DUAL;
    and I get >> ORA-01405: fetched column value is NULL.
    3. EXEC SQL SELECT 'name' INTO :db_neId :ind_ne FROM DUAL;
    and I get >> ORA-03106: fatal two-task communication protocol error.
    I haven't try to change the precompiler options yet. The program is very simple as I only use to test the connection with the database. I am just trying to retieve any character from the database.
    Any suggestions?

  • Setting VarChar Variable with String Parameter in Crystal Report Add Command

    Setting a VarChar Variable with a String Parameter in a Crystal Report 2008 SP6.3 Add Command is causing an error with a SQL State of 42000.  The Error Code depends on which value I select for the parameter.  I created the @DateOpt string parameter in the Modify Command window, not in the report. If I comment out line 14 of the SQL the error does not occur.
    I have attached the SQL Code and screen shots of the errors.   Please tell me what I am doing wrong.

    Since your parameter is of type STRING, you need to enclose references to it within the Command inside single quotes.
    For example, instead of
    SET @BeginDate ={?BeginDate}
    use
    SET @BeginDate ='{?BeginDate}'
    hth,
    - ido

  • How to replace a character in a string with blank space.

    Hi,
    How to replace a character in a string with blank space.
    Note:
    I have to change string  CL_DS_1===========CM01 to CL_DS_1               CM01.
    i.e) I have to replace '=' with ' '.
    I have already tried with <b>REPLACE ALL OCCURRENCES OF '=' IN temp_fill_string WITH ' '</b>
    Its not working.

    Hi,
    Try with this..
    call method textedit- >replace_all
      exporting
        case_sensitive_mode = case_sensitive_mode
        replace_string = replace_string
        search_string = search_string
        whole_word_mode = whole_word_mode
      changing
        counter = counter
      exceptions
        error_cntl_call_method = 1
        invalid_parameter = 2.
    <b>Parameters</b>      <b> Description</b>    <b> Possible values</b>
    case_sensitive_mode    Upper-/lowercase       false Do not observe (default value)
                                                                       true  Observe
    replace_string                Text to replace the 
                                         occurrences of
                                         SEARCH_STRING
    search_string                 Text to be replaced
    whole_word_mode          Only replace whole words   false Find whole words and                                                                               
    parts of words (default                                                                               
    value)
                                                                               true  Only find whole words
    counter                         Return value specifying how
                                        many times the search string
                                        was replaced
    Regards,
      Jayaram...

  • Problem with String variable

    I am new to Java Programming.
    I have a line of code that works and does what is supposed to.
    faceData.getProfile("Lisa").removeFriend("Curtis");
    If I assign the strings to variables such as-
    String name = "Lisa";
    String fName = "Curtis";
    and then plug those into the same line of code, it does not work
    faceData.getProfile(name).removeFriend(fName);
    What could be causing the problem?
    I even added some lines to print out what is stored in the variables to verify that they are what they should be, but for some reason the variables do not work while putting the strings in quotes does. Any ideas?

    I guarantee that something about your assertions are incorrect. Those variables are either not equal to the values you claim, or something else is going on. But it's not a problem with string variables versus string constants.
    Edit: My best guess in lack of a real example from you, is that the strings in question have non-printable characters in them, such as trailing spaces or line feeds.

  • Pad a string with zeros ?

    Hello ABAP Experts,
    How to pad a string with zeros.. is there a direct method i can use.
    eg:
    string length is 8
    string is custnumb
    value is 588
    but i would like to see 00000588
    please suggest.

    You can simply move it to a TYPE n field also.
    data: n(8) type n.
    data: custnumb(8) type c value '588'.
    n = custnumb.
    custnumb = n.
    Regards,
    Rich Heilman

  • Comma problem with global string variable

    Hi,
    I'm fiighting with comma problem for global string variable. I've on page string for example "7nndqrr52vzyb,0" and by dynamic column link I'm assigning this string to global variable. Then I'm trying to display value of that global variable on another page but I see only string till comma, nothings more. I'm not sure what I'm doing wrong because when I'm trying to assign that value normally by computation process as a constant value is fine and see on another page correct string. I'll be really glad for help.
    Thanks
    Cheers,
    Mariusz

    When it tries to display the string, it sees the comma and wants to believe the string is terminated. You could escape the , in the string or replace it with a different character..
    See this link: http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/concept.htm#BEIGDEHF
    Thank you,
    Tony Miller
    Webster, TX
    If vegetable oil is made of vegetables, what is baby oil made of?
    If this question is answered, please mark the thread as closed and assign points where earned..

  • Good practice to initalize all instance variables with type String to emptr

    Is it a good practice to initalize all instance variables with
    type String to emptry string?
    #1 approach:
    public class A
    { private String name = "";
    private String address ="";
    //etc...
    rather than
    #2 approach:
    public class A
    { private String name;
    private String address;
    //etc...
    When I read Java books, the examples don't usually do #1 approach.
    The problem is if we don't initialize to empty string, when we call
    the getter method of that instance variable, it will return null.
    Please advise. Thanks!!

    Please advise. Thanks!!It depends on your coding style. If you can avoid lots of checks for null Strings in the rest of the code then why not initialize to "".
    You have the same situation when a method returns an array. If you under circumstances return a null array reference then you have to always check for this special case, but if you return a zero length array instead you have no special case. All loops will just run 0 iterations and everything will work fine.
    So in general I guess the return of zero objects instead of null references really boils down to whether it simplicates the rest of your code by removing lots of extra checks for the special null case. This usage is especially favourable in the zero length array case. See Effective Java by Bloch, item 27.

  • Change Variable Type P to STRING but with thousand separators

    Dear all,
    I am no specialist (in abap/bsp).
    I have a variable 'number' type p decimals 0.
    I need that 'number' converted to a string but with the thousand separators.
    Is there a function available?
    Is is possible to give this function the desired character as a thousand separator?
    E.g.
    Character '.'  for German Number Format
    Character ',' for US Number Format.
    Thank you in advance for help.
    Rewarding Points for helpful answers guaranteed.
    Philipp

    Hi Philipp,
    I have written a report for you.
    Just copy & paste the below code in your report.
    Try changing the num variable in the report and see the result.
    DATA: num TYPE p DECIMALS 0,
          de_str TYPE string,
          en_str TYPE string.
    DATA: temp_str TYPE string,
          str_len TYPE i,
          count TYPE i,
          index TYPE i,
          sub_str TYPE string,
          sub_str_len TYPE string.
    num = 1234567890.
    temp_str = num.
    str_len = STRLEN( temp_str ).
    str_len = str_len - 1.
    IF str_len >= 3.
      count = str_len DIV 3.
      index = 0.
      DO count TIMES.
        sub_str_len = ( count ) * 3.
        count = count - 1.
        index = str_len - sub_str_len.
        IF index < 3.
          sub_str_len = index.
          index = 0.
        ELSE.
          sub_str_len = 3.
          index = index - sub_str_len.
        ENDIF.
        IF index NE 0 OR sub_str_len NE 0.
          sub_str = temp_str+index(sub_str_len).
          CONCATENATE de_str sub_str '.' INTO de_str.
          CONCATENATE en_str sub_str ',' INTO en_str.
        ENDIF.
      ENDDO.
      index = str_len - 3.
      sub_str = temp_str+index(3).
      CONCATENATE de_str sub_str ',' '000' INTO de_str.
      CONCATENATE en_str sub_str '.' '000' INTO en_str.
    ELSE.
      sub_str = temp_str+0(str_len).
      CONCATENATE de_str sub_str ',' '000' INTO de_str.
      CONCATENATE en_str sub_str '.' '000' INTO en_str.
    ENDIF.
    WRITE:  temp_str,
           / de_str,
           / en_str.
    Hope it helps you.
    Regards,
    Maheswaran B
    I have done a small change. Try it now!
            Maheswaran B
    Message was edited by:
            Maheswaran B

  • Padding a string with spaces

    How do you pad a string w spaces using "Format into a string" w/o typing /s/s/s/s/s for say 5 spaces ?
    Solved!
    Go to Solution.
    Attachments:
    printed output.PNG ‏6 KB
    wire diagram.PNG ‏11 KB

    Hi Clint,
    this way:
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Problem with a String[] variable

    Hi
    I'm reading values from a table and I need to store them in a String[] variable.
    This example shows I would do it without accesing to the database: String[] data = new String[] {"a","b","c"};
    Now, I want to do the same thing but reading it from a database table. I do know how to read each value from the table, the problem is that I'm not sure on how to concatenate the values in the string[].
    Thank you all in advance =)
    Yesenia

    int count = triptypeDataProvider.getRowCount();
    String[] triptypes = new String[count];
    int row=0;
    try {
    triptypeDataProvider.cursorFirst();
    do {
    triptypes[row] = triptypeDataProvider.getValue("triptype.name").toString();
    row++;
    } while (triptypeDataProvider.cursorNext());
    } catch (Exception ex) {
    error("put your message here" +
    ex.getMessage());
    log("put your message here: " +
    ex.getMessage(), ex);
    }

  • Pass Input Parameter With Blank To SSIS Get Strange Result

    Hi! I stuck for a while when executing SSIS from stored procedure with input parameter. My input value is not consistent with output one. If I pass value with blank , SSIS seems gets second part. For example , if I pass "CALL FROM SP", SSIS get
    "FROM" only. 
    I use Execute SQL Task to store input parameter. Here is the SSIS snapshot.
    And here is the sp snippet
    DECLARE @Path VARCHAR(200),
    @Cmd VARCHAR(4000),
    @ReturnCode INT,
    @QUERY_STRING VARCHAR(70),
    @BATCH_NO VARCHAR(14)
    SELECT @Path = 'xxxxxx'
    SELECT @QUERY_STRING = 'CALL FROM SP'
    --BatchNo = YYYYMMDDHHMMSS
    SELECT @BATCH_NO = CONVERT(VARCHAR(10),GETDATE(),112) + REPLACE(CONVERT(VARCHAR(8),GETDATE(),108),':','')
    SELECT @Cmd = 'DTexec /FILE "' + @Path + 'Package1.dtsx" /MAXCONCURRENT 1 /CHECKPOINTING OFF /REPORTING EW ' + '/Decrypt ALCM '
    + ' /SET \Package.Variables[User::BATCH_NO].Properties[Value];' + @BATCH_NO
    + ' /SET \Package.Variables[User::QUERY_STRING].Properties[Value];' + @QUERY_STRING
    My test are
      input parameter
     write to TESTTB correctly ? 
    any error?  
     execute SSIS in design mode
     CALL FROM SSIS
     YES
     execute SSIS by sp
     CALL FROM SP
     NO
     Option "FROM" is not valid.
     execute SSIS by sp
     CALL_FROM_SP
     YES
    Anyone could give me some hint ? 
    Thank you so much!!

    Hi Nick,
    It occurs because an argument of the DTExec commands must be enclosed in quotation marks if it contains a space. From the dtexe (SSIS Tool): Syntax Rules section of the
    dtexec Utility (SSIS Tool) document, we can see:
    All options must start with a slash (/) or a minus sign (-). The options that are shown here start with a slash (/), but the minus sign (-) can be substituted.
    An argument must be enclosed in quotation marks if it contains a space. If the argument is not enclosed in quotation marks, the argument cannot contain white space.
    Doubled quotation marks within quoted strings represent escaped single quotation marks.
    Options and arguments are not case-sensitive, except for passwords.
    So, you need to make the value of the variable @QUERY_STRING within double quotes in the value of the variable @Cmd or remove the space within the @QUERY_STRING value.
    Regards,
    Mike Yin
    TechNet Community Support

  • Pass parameter with blank space for report ver 6

    Hi,
    I face a problem that i willing to pass the acno where it's value with blank space, for example ' 9' as parameter into my report, and assign it as v_acno. Inside the report query i add a where condition, acno >= :v_acno. When i run the report and pass acno without ' , it do not show any record. But when i run the report and pass acno with ' then able to show the records.
    for example the value i key in
    with ' = ' 9'
    without ' = 9
    So how i can solve it by pass the acno without ' but the record still able to show?
    thks
    Message was edited by:
    user569740
    Message was edited by:
    user569740

    Hi Nick,
    It occurs because an argument of the DTExec commands must be enclosed in quotation marks if it contains a space. From the dtexe (SSIS Tool): Syntax Rules section of the
    dtexec Utility (SSIS Tool) document, we can see:
    All options must start with a slash (/) or a minus sign (-). The options that are shown here start with a slash (/), but the minus sign (-) can be substituted.
    An argument must be enclosed in quotation marks if it contains a space. If the argument is not enclosed in quotation marks, the argument cannot contain white space.
    Doubled quotation marks within quoted strings represent escaped single quotation marks.
    Options and arguments are not case-sensitive, except for passwords.
    So, you need to make the value of the variable @QUERY_STRING within double quotes in the value of the variable @Cmd or remove the space within the @QUERY_STRING value.
    Regards,
    Mike Yin
    TechNet Community Support

  • Padding a field out with spaces to s set length

    Post Author: danish
    CA Forum: Formula
    Hi,
    I'm new at using Crystal Reports.
    I am trying to pad a string out to a set length of 50. The initial string is of variable size depending on the data in the field.
    Can anyone tell me how I can do this using a while do loop.
    ie while field length < 50 add a space to field until field length = 50.

    Post Author: danish
    CA Forum: Formula
    Thanks for that. Managed to work out how to do with while do but this will be helpful for future.

Maybe you are looking for

  • Boot Camp not working with Windows 7!

    I have a 2011 MBP which has Boot Camp installed w/ Windows 7. I recently had to reinstall Boot Camp after a bad experience with Windows 8, and I've started Windows 7 fresh. I used it 5 or 6 times, but now when I go to use Windows 7 all I get is a bla

  • Compaq Presario CQ61-100SO

    Hello! I have a Compaq Presario CQ61-100SO Notebook PC, and I have a question... does my computer have Bluetooth? I searched through my computer and couldn't find it, so I went to my manufacturer's website and searched there, but couldn't find anyth

  • Change external serial numbers

    Hello Folks, The serial numbers at the Client place have year stamp (external numbers). here is an example of it ex : 0988880000001 Where first 2  digit "09" is a year stamp the next 4 digits are material code - "8888" the last 7 digits are for piece

  • Once I fix the thumbnail pictures in iPhoto, how do I make them stay fixed.  Everytime I turn the computer back on iPhoto goes directly back to having 1 picture for all thumbnails.

    I have been having problems with the thumbnail pictures in iPhoto.  It will typically show 1 picture for all thumbnails.  I have figured out how to repair the thumbnail pictures, but everytime the computer is shut down, the thumbnail pics revert back

  • 881W Integrated AP

    I am having an issue with an 881W router with the integrated AP. Our campus is using 1310 bridges to connect a remote apartment that houses students. Within that apartment we have a 881W router and are using the integrated AP. We have the advancedips