GREP expression to remove trailing zeros?

Hi,
I have to find and change multiple entries of trailing zeros. Please find sample below to understand type entries need to be change.
1.00              -> 1
0.01200         -> 0.12
4.50              -> 4.5
0.0040           -> 0.004
Please help me how can i use grep to find and change in CS6
Thanks in Advance.
Sanjay

Peter,
Right! In 3 steps (text in black)
1/ Exclusion if no decimal part:
Find: ,?(?<![\.\d])(\d+)(?![\.\d])
Replace: color X
2/ Treatment:
Find: (?<=[\.\d])\.?0+(?=\s)
Search Format: color black
Replace: nothing
3/ Treatment:
Search Format: color X
Replace Format: color black
Seems to work. To be validated! 

Similar Messages

  • I want to remove Trailing zeros from a charecter value

    Hello ,
              i want to remove trailing zeros for a prticular value.Following is my code :
    DATA: V_FLOAT TYPE F VALUE '4.8240000000000000E+03',
               V_CHAR(25) ,
               P10_4(10) TYPE P DECIMALS 4.
    CALL FUNCTION 'CEVA_CONVERT_FLOAT_TO_CHAR'
    EXPORTING
    FLOAT_IMP = V_FLOAT
    FORMAT_IMP = P10_4
    ROUND_IMP = ' '
    IMPORTING
    CHAR_EXP = V_CHAR.
    SHIFT V_CHAR RIGHT DELETING TRAILING '0'.
    WRITE : V_CHAR ."NO-ZERO.
    <u><b>Output:</b></u>
    if we pass the value '1.3000000000000000E+01' it should be 13.0
    ex2: '1.3400000000000000E+01' it should be 13.4
    ex3:'4.8240000000000000E+03' it should be 4824
    is there any way to get the solution without functional module. If so Please tell me with code.

    hi
    u can do it in number of ways.
    Use TCODE SU3
    Select default tab and select radio button 123467.89 in decimal notation and save it.
    or u can try :
    if you want to do this through ABAP program.
    1. to delete trailing spaces.
    SHIFT <V_VARIABLE> RIGHT DELETING TRAILING '0'.
    to delete leading zeroes,
    SHIFT <VARIABLE_NAME> LEFT DELETING LEADING '0'.
    only for one abap program, u can use set country command
    for all programs :
    sap menu>system->go to user profil->own data>default --> and choose ur format.
    hope this helps u.
    Regards,
    Prasanth
    Reward all hepful replies

  • How to remove trailing zeros from a fraction part.

    How to remove trailing zeros from fraction part, need standard API rather then some java code.

    user8726363 wrote:
    How to remove trailing zeros from fraction part, need standard API rather then some java code.I'm pretty sure we have all gathered that English is not your first language, but your question is not a good question in any language.
    Back up. Take a deep breath.
    Now - what's your problem ?
    Please illustrate with results, and the code (just the class/method; not your entire application) that is causing them.
    Winston

  • How to remove trailing zeros using EngineeringFormatInfo?

    HI,
    I found a measurement studio formatter for SI notation.  
    For details, see the NI document.
    Here, I want to know how to remove any trailing zeros. I could not find any information about this. 
    For example, 
    code : string result = string.Format(EngineeringFormatInfo.Default, {0:s5}, double value)
    if  value = 1.2345678E-3,  result is 1.23457E-3. It is ok. 
    if  value = 1.2E-3,  result is 1.20000E-3. But I want to get "1.23m". 
    In labview, I usually use "%#.5p" format string.

    diluculo wrote:
    HI,
    I found a measurement studio formatter for SI notation.  
    For details, see the NI document.
    Here, I want to know how to remove any trailing zeros. I could not find any information about this. 
    For example, 
    code : string result = string.Format(EngineeringFormatInfo.Default, {0:s5}, double value)
    if  value = 1.2345678E-3,  result is 1.23457E-3. It is ok. 
    if  value = 1.2E-3,  result is 1.20000E-3. But I want to get "1.23m". 
    In labview, I usually use "%#.5p" format string.
    I don't understand how you are getting 1.23457E-3 ?  And claiming that is okay.
    If you are using the format string that you claim you are using, then you should be getting 1.23457m.
    It sounds like you are using string result = string.Format(EngineeringFormatInfo.Default, {0:E5}, value)

  • How to remove trailing zeros 20353675.0000000

    All numeric decimal columns all are showing trailing zeros, how to remove them while processing within the query transform.
    20353675.0000000
    Thanks a lot for the helpful info

    You can use the trunc function to remove the decimal places.
    Syntax: trunc( number, [ decimal_places ] )
              <number> is the number to truncate.
             <decimal_places> is the number of decimal places to truncate to. This value must be an integer. If this parameter is omitted, the trunc function will truncate the number to 0 decimal places.
    Eg:     trunc(125.815)  would return 125
              trunc(125.815,0)  would return 125
              trunc(125.815,1)  would return 125.8
             trunc(125.815,2)  would return 125.81
             trunc(125.815,-1)  would return 120

  • Remove trailing zeroes in quantity field.

    Hi all,
    I am having quantity field in ALV grid display : VBAP-KWMENG. Iam getting quantity value as 1,000.My requirement is to get quantity value as 1.(without ',' and zeroes).
    Suggest me a suitable solution.
    Thanks all.

    Other way is check for the below code ..
    DATA:
      lv_decimal TYPE f DECIMALS 3,
      lv_string  TYPE string.
    lv_decimal = '22.010'.
    WRITE lv_decimal TO lv_string.
    SHIFT lv_string RIGHT DELETING TRAILING '0'.
    * also delete trailing '.', if possible
    SHIFT lv_string RIGHT DELETING TRAILING'.'.
    CONDENSE lv_string NO-GAPS.
    * now no trailing zeros are in the decimal stored in LV_STRING

  • Formula in transformation file to remove trailing zeroes,BPC 7.5 NW

    Hi Experts,
    I have implemented automation of master data from BW info object to BPC dimension.
    I have few issues with the transformation file. employee percentage in BW is of type number and has lenght of 17.
    In BW 0EMPLPCT holds the value as 100,000 , 75,000  but when i send to BPC dimension the values are sent as 100,00000
    Emp percentage is maintained as below in the transformation  file.
    EMP_PC=0EMPLPCT
    However i wanted to remove the zeroes in BPC , i wanted to see the numbers as 100, 75, 50 and so on.
    Is there any way i can handle this in transofrmation file. Please let me know as this is really urgent. Thanks much.
    Regards,
    Sanjeev

    Hi,
    The properties in BPC are stored as string. So, you will have to convert it to string while loading. Secondly, it will be really difficult to use this percentage value in any script logic; since it is stored as string.

  • How to remove trailing zeros from a decimal (type) value?

    Hi Everyone,
    I would like to 'drop' some trailing zeros from a decimal value, e.g.: 50.000000, and I am wondering how to go about this?
    The value is definitely of decimal type, and in this instance I know that I want to eliminate exactly six (6) zeros.
    Any help here will be greatly appreciated.
    Kind Regards,
    David

    Try the below:
    This is sort of a display issue, you may do it at Application side, which would be efficient.
    Declare @s Decimal(10,6)='50.0000000'
    Select Cast(@s as decimal(10,0))

  • Remove trailing zeros

    Hi,
    I want to write a program to remove any unnecessary zeros of a non whole number.
    ex. 1.00100 should be converted to 1.001.
    Pattern pattern = Pattern.compile("0+$");
    Console console = System.console();
    String word = console.readLine("%nEnter number - ");
    Matcher matcher = pattern.matcher(word);
      if (word.indexOf('.') > -1)
             System.out.println("Number after - " + matcher.replaceAll(""));
      else
              System.out.println("Number after - " + word);
       }It seems to work fine. But the pattern "0*$" also seem to work. I tested this program with both patterns for few numbers and it works.
    What is the best pattern which will provide most accurate results to accomplish my task.
    Do you see any problems of using any of the mentioned patterns or is there an another way to do it?
    Thanks,
    Chamal.

            String[] values =
                "1.00100", "100","000"
            for (String value : values)
                System.out.println(value.replaceFirst("(?<=\\.\\d{0,30}?)0*$", ""));

  • How to delete trailing zeros from a quantity field to display in ALV?

    Hi there,
    i am retrieving the field LGMNG from LIPS table, which is of type QUAN(13). All LGMNG values there are stored as
    1,000
    20,000
    50,000 etc.
    But i want my values to be displayed as
    1
    20
    50 etc.
    i have tried the " shift v_variable right deleting trailing '0'" but it does not work.
    also, if the value of LIPS_LGMNG =  0,000, i need those columns in ALV empty(that is no zeros or comma displayed)
    can anyone please help?
    Thanks a lot,
    Mee

    hi,
    use this it will solve your problem, just write down this on your Fieldcatalog.
       WA_FIELDCATALOG-FIELDNAME = 'VALUE7'.
       WA_FIELDCATALOG-SELTEXT_L = 'Contribution EE(due)'.
      WA_FIELDCATALOG-DATATYPE = 'INT2'.           " it will remove trailing zero
      WA_FIELDCATALOG-DECIMALS_OUT = 0.
       APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
       CLEAR WA_FIELDCATALOG.

  • Trailing Zeroes in Table

    Why does Pages REMOVE trailing zeroes in a table? I type 467.6750 and tab to the next cell, and Pages DELETES that ending zero.
    Where can I change that?
    Many thanks.

    clint,
    My guess is that Pages "corrects" the trailing zero because it deems it unnecessary. You can fix it by selecting your table, then clicking on the Table inspector > Format > Cell Format > Text. Assuming you're not using your table to create formulas, treating the numbers as text shouldn't be a problem.
    -Dennis

  • Removing Leading And trailing Zeros

    Hi Guys ,
    Can You help me out in UDF for removing leading and Trailing zeros
    Ex :  0123.234000000
    And it must satisfy below conditions .
    1 ) If value as Null we need 0.0 in target
    2) if the value is 0.0 we need 0.0 in target
    Thanks in Advance

    One more option:
    Input will be "str" of type string.
    Execution type: single value.
    mapping:
    Input -> mapwithdefault(0.0)->UDF->output
    if( !str.equals("0.0"))
    char[] chars = str.toCharArray();
    for (int index=0; index < str.length();index++)
    if (chars[index] != '0')
    str =str.substring(index);
    break;
    int length,index1 ;
    char[] chars1 = str.toCharArray();
    length = str.length();
    index1 = length -1;
    for (int in1=index1-1; in1>0;in1--)
    if (chars1[in1] != '0')
    str=str.substring(0,in1+1);
    break;
    return str;
    else
    return "0.0";
    http://wiki.sdn.sap.com/wiki/display/Java/RemoveLeadingandTrailingZerosfroma+String

  • Report Builder: output to Excel removes leading zeros

    I'm trying to use the Report Builder to output a numeric
    field to EXCEL , but on numbers that start with zero EXCEL removes
    the leading zero's. ex. 00123 becomes 123.
    Is there something that I can put in the expression builder
    on the field to overcome this.
    I've tried concatonating a single quote on the front of the
    field but the single quote shows up on the output. I've tried this
    on both the SQL and on the expression builder.
    I've read on some of the posts where people have tried using
    'mso-number-format:"\@'" within a TD tag but I can't seem to get
    the syntax right inside the Expression Builder.
    Has anybody got any suggestions?

    Excel will remove leading zeros in a numeric field because it is treating the column as numeric. Putting a ' in front of the number forces Excel to treat the column as text.

  • Report builder in BO - Removing trailling zeros

    I have a field that can have up to 5 deciaml value like 0.12345..  But if the amount is 0.12300 i want to remove the trailling zeros so i would get 0.123 on my report. I have a formula for crystal report but i cant put the 'if' condition in BO Report builder.
    Help please
    Thanks to all

    > I have a field that can have up to 5 deciaml value
    > like 0.12345..  But if the amount is 0.12300 i want
    > to remove the trailling zeros so i would get 0.123 on
    > my report. I have a formula for crystal report but i
    > cant put the 'if' condition in BO Report builder.
    Hi Alain,
    In Print Layout Designer, the Round function allows you to round decimal values to a selected (fixed) amount of decimals. However, this is not exactly what you are looking for. As far as I know, there is no way you could do the removal of trailing zeros in PLD. A common workaround (although a really ugly one) to this problem as well as to many other PLD problems is to do the processing with formatted search in a UDF and just print whatever you have in the UDF.
    IMHO, the Print Layout Designer is by far the most frustrating component of B1. I don't mind that it's got a clumsy user interface, but the limited availability of fields&functions is just outrageous. To make things worse, it seems there are practically no significant improvements in the PLD for B1 2006.
    Henry

  • Add Trailing  zeros to a number or char

    Hi Experts,
               my material number is stored in the form of Character so i want to add a trailing zero to that number
               supposr for example my material number is ccf5a   so i want add zeroes to make it 18  like   cf5a0000000000000 characters
              Please help me on this  hoping for the quick replay.

    Use [CONCATENATE|http://help.sap.com/abapdocu/en/ABAPCONCATENATE.htm] (only once with a constant initialized with 18 zeroes)
    or
    go to [PAD|http://help.sap.com/abapdocu/en/ABAPCOMPUTE_STRING_FORMAT_OPTIONS.htm#!ABAP_ADDITION_3@3@] in [Embedded expressions format_options |http://help.sap.com/abapdocu/en/ABAPCOMPUTE_STRING_FORMAT_OPTIONS.htm] in [String Templates - embedded_expressions|http://help.sap.com/abapdocu/en/ABENSTRING_TEMPLATES_EXPRESSIONS.htm] in [string_exp - String Templates |http://help.sap.com/abapdocu/en/ABENSTRING_TEMPLATES.htm] in [string_exp - String Expressions|http://help.sap.com/abapdocu/en/ABAPCOMPUTE_STRING.htm] in [Expressions and Functions for String Processing |http://help.sap.com/abapdocu/en/ABENSTRING_PROCESSING_EXPR_FUNC.htm]
    Regards,
    Raymon

Maybe you are looking for

  • Creating storage repository in OVM 3.0.x

    Hi, I am new to OVM. I have installed OVM 3.0.1 version Manager and Server. And I am trying to create a Virtual machine (domU) and want to install one of OEL template as guest OS. Now I am in the process of creating a storage repository where in whic

  • When is it coming out

    hello I'm new here please don't flame me okay now I live in Ottawa Canada and I was wondering when I should start seeing the new ipod in my local best buy or such stores?

  • Move cloud licence to another computer for one week

    I've come away from the office with my laptop but forgotten the charger so I can't use Creative cloud on it. Is there any way I could run it from my home desktop for one week only?

  • Delete blog in iweb which acts as index to whole website

    Does anyone know if I can delete one of my blogs on my website which acts as the opening page of the site, in other words as the index? My files got corrupted, and although I've gone to .mac and downloaded the whole site, I can't make iWeb see the fu

  • No sim

    No sim message