How to delete Trailing zeros in a string array

I am reading data from RS232 port and storing the values in an array of 16 nos. Then converting the array of numbers into string using 'number to fractional string" function with precession 2  and sending the data string to Table. I am printing this table further for report generation.
I am unable to remove the trailing zeros as i am defining precession 2 which is not needed for all the numbers in the table.
Please help me how to remove the trailing zeros after decimal point which is very much necessary for report generation.
regards
Prasanna Kumar N M

Use format into string in a FOR loop with a format specified of %#f. See attached example (LabVIEW 7.0)
Message Edited by altenbach on 10-14-2006 05:40 AM
LabVIEW Champion . Do more with less code and in less time .
Attachments:
AutoFormat.vi ‏17 KB
AutoFormat.png ‏3 KB

Similar Messages

  • How to delete trailing zeros after decimal ?

    Hi,
    i want to delete trailing zeros after decimal.
    Example:
    if it is 22.000 then output will be 22
    if it is 22.010 then output will be 22.01.
    plz let me know hw to do this ?

    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'.
    CONDENSE lv_string NO-GAPS.
    * now no trailing zeros are in the decimal stored in LV_STRING
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Jan 30, 2008 12:10 PM

  • 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.

  • How to delete trailing zeros after the decimal point in the ALV sum

    Hello Expert,
    In my alv output, I need to sum up one column, but in the sum result, I don't want to display zeros after the decimal point.
    for example,
    If the sum is 134.00, I only want to display 134 on the alv.
    Does any expert have idea about it?
    Thanks in advance,
    best regards, Johnny

    Hi ,
    Use following
    SHIFT variable RIGHT/LEFT DELETING TRAILING '0'.
    For more variations ,
    just write SHIFT and press f4 , it will show you the information you need.
    Hope this is helpful,
    Regards,
    Uma Dave

  • 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 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))

  • 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

  • How to delete leading zeros for amount  fields

    Hi all,
    I have problem with the leading zeros, where I am populating nearly 30 amount fileds in my  statement.i want to delete leading zeros.
    I have tried with shift and pack.
    and I cannot call every time the function module *alpha_output or input.
    can anybody suggest me the better solution.
    Regards,
    Sre

    You could use a syntax like 
    SHIFT: w10a LEFT DELETING LEADING '0',
           w10b LEFT DELETING LEADING '0',
           w10c LEFT DELETING LEADING '0',
           w10d LEFT DELETING LEADING '0'.
    or using macros like
    DEFINE delzero.
      shift &1 left deleting leading '0'.
    END-OF-DEFINITION.
    delzero: w10a, w10b, w10c, w10d.
    Regards

  • How to add leading zeros to hex string?

    Hi, I've got the following problem:
    I have a string that represents a 8-digits hexadecimal number. But if the number has less as 8 digits, I need to add the leading zeros. I can't use DecimalFormat, 'cause it works only with decimal numbers. Is there any elegant solution to add the leading zeros to hex string (for example "A3F" to "00000A3F")

    Or better use a StringBuffer for that, though I doubt it's a performance problem in your case.

  • How to delete a particular data from 3 arrays

    hello,
    i have a program that works like this.....
    import java.io.*;
    public class NewMain {
    BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
    String [] Type= new String[10000];
    int [] Num= new int[10000];
    float [] Price= new float[10000];///////
    and i am reading some of the data into these arrays
    so if i want to delete a particular data from the arrays how do i do that
    and if i want to delete pants from that file and enter the text again how do i do that.? any idea?....
    e.g if the file contains
    shirt
    32
    56.5
    pants
    56
    45.9

    Ashish.Uppin wrote:
    hello,
    i have a program that works like this.....
    import java.io.*;
    public class NewMain {
    BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
    String [] Type= new String[10000];
    int [] Num= new int[10000];
    float [] Price= new float[10000];///////
    and i am reading some of the data into these arrays
    so if i want to delete a particular data from the arrays how do i do that
    and if i want to delete pants from that file and enter the text again how do i do that.? any idea?....
    e.g if the file contains
    shirt
    32
    56.5
    pants
    56
    45.9
    Buddy, it seems to me that you are describing data that belongs together -- a class. You are probably better off with one arraylist of objects of this class, each object having a String type variable, an int num variable, and a float price variable, make that a double price variable.
    For examples of arraylists in action, please see the Sun java tutorials.

  • How to use a WebService Model with String Arrays as its input  parameter

    Hi All,
    I am facing the following scenario -
    From WebDynpro Java i need to pass 2 String Arrays to a Webservice.
    The Webservice takes in 2 input String Arrays , say, Str_Arr1[] and Str_Arr2[] and returns a string output , say Str_Return.
    I am consuming this WebService in WebDynpro Java using WEB SERVICE MODEL. (NWDS 04).
    Can you please help out in how to consume a WSModel in WD where the WS requires String Arrays?

    Hi Hajra..
    chec this link...
    http://mail-archives.apache.org/mod_mbox/beehive-commits/200507.mbox/<[email protected]>
    http://www.theserverside.com/tt/articles/article.tss?l=MonsonHaefel-Column2
    Urs GS

  • How to delete trailing spaces or invalid characters

    Hi experts,
    I am loading data into a DSO. But in the activation it is showin error. Data is coming upto New data table. After that it is showing error as:
    =============================================
    Value 'Eversafe ' (hex. '204576657273616665 ') of characteristic 0CUSTOMER contains invalid characte .
    Diagnosis
        Only the following standard characters are valid in characteristic
        values by default:
        !"%&''()*+,-./:;<=>?_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.
        Furthermore, characteristic values that only consist of the character #
        or that begin with ! are not valid.
        You are trying to load the invalid characteristic value Eversafe &
        (hexidecimal representation 204576657273616665 ).
    System Response
    Procedure
    Procedure for System Administration
        Try to change the invalid characters to valid characters.
        If you want values that contain invalid characters to be admitted into
        the system, make the appropriate setting in BW Customizing . Refer to
        the documentation describing the requirements for special characters and
        the possible consequences.
    ===========================================
    After i edit this in psa it is showing another record as error.
    I think we have to delete the trailing spaces. If this is the case anyone please provide me how to write routine in the transfer rules to delete the trailing space.
    Full points will be assigned.
    Thanks & Regards,
    V N.

    Hi Venkat,
    Thanks for your reply.
    How can i know what are the extra invalid characters to be permitted.
    And also i am getting a message while activating the DSO as follows:
    ============================================
    Activation of M records from DataStore object ZDSO_OO3 terminated
    Process 000033 returned with errors
    =============================================
    Please help me to solve this issue.
    Thanks & Regards,
    V N.

  • How to delete last character in a string

    Guys i have a question...
    how can i delete the last character in a string..
    for example
    String myString = "helloWorld, ";
    how do i delete the last character in this string which is a "," ?

    String newString = myString.substring(0, myString.length()-1);

  • How to delete excessive spaces for a string??

    like String s="i am a new guy"
    how to make it to "i am a new guy" ??
    i've tried trim() seems it does work for this case
    thanks

    oh......no i typed several spaces symbol between "i"
    and "am" in the first sentence, but this forum seems
    ignore those blank spacesIt doesn't if you use code tags. And it's not the forum, but HTML standard.
    so what i am trying to do is. what if there are say,
    100 spaces between two words in a sentence (string)
    and i want to delete the excessive space and make it
    just one space between two wordsThen trim() doesn't do what you want it to do. As the documentation clearly describes. Use replaceAll.

Maybe you are looking for