Strip decimal point from string

Is there an easy solution to strip a decimal without the whole charAt stringbuffer thing.
I try this
String test = "1.234";
String stripped = test.replace('.','/');
and i get "1/234" as result. But I dont want "/". I want blank.
This doesnt compile
String stripped = test.replace('.','');

If you want blank (1 234) then
String stripped = test.replace('.',' ');
will work. If you want to just remove the decimal point (1234) then
test = "1.234";
String[] prts = test.split("\\.");
System.out.println(">>>" + prts.length + "<<<<");
if (prts.length > 1) { test = prts[0] + prts[1]; }
else { test = prts[0]; }
System.out.println(">>>" + test + "<<<<");

Similar Messages

  • Existance of decimal point in String using UDF

    hi,
    How would i know the existance of decimal point in String using UDF in SAP XI message mapping?
    Regards,
    Sanghamitra

    public String calculate(String var1, Container container) throws StreamTransformationException
    Boolean b=var1.contains(".");
    if(b)
    return "true";
    else
    return "false";
    Also using standard function IndexOf you can achive this.

  • Conversion issues with decimal points from v5.1.5 to XI

    Several reports which were converted from v5.1.5 full client to XI Webi have numeric differences. When comparing v5.1.5  to XI, the sums on the columns don't exactly match. The cell format on these numbers is set to eight decimal points. When we converted, I noticed the cell format changed from number 0.00000000 in 5.1.5 to custom 0.00000000 in XI. I don't know if this is the reason the sums don't match or if it's something else.

    Hello Ellen,
    as you refer to a Webi problem I recommend to post this query to the [BusinessObjects Web Intelligence|SAP BusinessObjects Web Intelligence; forum.
    This forum is dedicated to topics related to the creation and design of Web Intelligence documents using the Web Intelligence Report Panels. This includes areas such as universe connectivity, prompts, charting, formatting, filters, and formulas.
    It is monitored by qualified technicians and you will get a faster response there.
    Also, all Webi queries remain in one place and thus can be easily searched in one place.
    Best regards,
    Falk

  • Stripping numeric value from string

    I have a field in my database that stores the following information related to an invoice:
    _FieldName_
    Invoice  9999 for client ABC on 021909.pdf
    Invoice 10000 for client DEF on 032309.pdf
    Invoice 10001 for client GHI on 041209.pdf
    etc...
    I would like to strip the string and return just the invoice number in SQL.  I need to add the sql statement into my Add Command in Crystal.
    Any suggestions on how I can do this?
    Thanks in advance,
    Zack H.

    Thank you all for posting a viable solution.
    This also worked:
    SELECT SUBSTRING(FieldName,  CHARINDEX(' ', FieldName)+1
                   , (CHARINDEX(' ', FieldName, CHARINDEX(' ', FieldName)+1)) - (CHARINDEX(' ', FieldName)+1)
    FROM myTable
    Regards,
    Zack H.

  • Remove decimal points from variable.

    Hi,
    I have a little issue.
    I have one variable v = 25.000
    and i want to remove (.000) from this variable so my result will be only 25 and i want this.
    So, is ther any function to remove this?
    I want to do it in one shot.
    No 2-3 statements.
    Points rewarded soon
    Regards
    RH

    Hi Ronny,
    You move this variable data to an integer variable.
    Data: v_tempint   type i.
    move your_variable to v_tempint.
    v_tempint will have the required result.
    Reward points if this helps,
    Kiran

  • Strip html tags from string & convert ampelsand charachters

    hello, i'm converting html into xml, and i need to convert html code & content into xml content, withouth the html tags ...
    so, for example, I strip this out of an html file:
    <A NAME="b_betreft"></A>STUDIEOPDRACHT "UITBREIDING VIPA NAAR MEERDERE SUBSECTOREN" HERVERDELING VASTLEGGINGS- EN VEREFFENINGSKREDIETEN VAN HET VIPA VOOR HET JAAR 1999 ONTWERPBESLUIT VAN DE VLAAMSE REGERING TOT HERVERDELING VAN BASISALLOCATIES VAN DE BEGROTING VAN HET VLAAMS INFRASTRUCTUURFONDS VOOR PERSOONSGEBONDEN AANGELEGENHEDEN VOOR HET BEGROTINGSJAAR 1999<A NAME="e_betreft">
    and i want to get rid of the "<A NAME="b_betreft"></A>" & "<A NAME="e_betreft">", are there classes that can do this ???
    probably there are, i know in php there are ..., how about java ???
    also i'll need to correct stuff like:
    Financi&euml;le => Financi�le
    Comit&eacute=>Comit�
    you see, then, i'm done, cool ...
    thanks dudessssss

    hello, i'm converting html into xml, and i need to
    convert html code & content into xml content,
    withouth the html tags ...Why didn't you continue to post in your other thread?
    http://forum.java.sun.com/thread.jspa?threadID=777660
    It's not nice to create multiple threads with the same question.
    Kaj

  • Remove decimal points

    Hi,
    how to remove decimal points from all the columns in table in obiee
    thanks

    hi
    add one decimal point
    is this the same? or any?
    Cheers

  • Change decimal points in SD Condition type from 2 to 3, for EU

    Hello,
    We have a slight problem with the amounts. We are using resource related billing in the project and to track some expenses, there are some condition types created. Since the currency is maintained as EU, the decimal places are maintained as 2 decimals in OY04 and we dont want to change that.
    We face an issue, when SAP Converts condition value from 3 to 2 decimals
    For example, when in Contract we have an Condition Value of 100.025, this is converted to 100.03 and tax is applied on this amount.
    When we create an invoice and subsequently a Credit Memo request, that will contain more than one item, and the sum of all items will have to sum up to 100.03, but this is never the case, as with the application of tax rate, the value comes to something like 100.02 or 100.04..
    With 3 decimal points, this amount adds upto correct value.
    So our ideal solution will be the have the Condition Values as 3 decimals and the Net value in 2 decimals.
    Is there something  that can be done for this?
    Hoping for a quick response.
    Regards
    Maddy

    SAP stores the 3 decimal value in XKOMV-kbetr and Xkomv-kwert is calculated based on this 3 decimal values...
    I had a similar scenario with currency conversion and rounding issue in sales Order and Invoice processing, in VOFM routines... so I used a Floating point  value and converted to character value and then used that 3 decimal value for calculation.

  • How to set Decimal Point position from right to left Serial Read Evaluate Number within Range over RS-232

    I am new to Labview, I am communicating with a TQ8800 Torque meter via RS-232. The 16 digit data stream is as follows:
    D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
    Each digit indicate the following status :
    D0 End Word
    D1 & D8 Display reading, D1 = LSD, D8 = MSD
    For example :
    If the display reading
    is 1234, then D8 to D1 is :00001234
    D9 Decimal Point(DP), position from right to the left
    0 = No DP, 1= 1 DP, 2 = 2 DP, 3 = 3 DP
    D10 Polarity
    0 = Positive 1 = Negative
    D11 & D12 Annunciator for Display
    Kg cm = 81 LB inch = 82 N cm = 83
    D13 1
    D14 4
    D15 Start Word
    I am using a modified version of the basic_serial_write_read.vi. I am attempting to parse the 16 digit data stream extracting out the number and whether it is positive or negative. I am having trouble with the decimal point placement. Is there an example that could help me with this? After the number is parsed I am then comparing it to see if it is within +/- 9.2 N cm. If it is then the test passes. I am outputing the data to a file. I have included the vi. Also how can I check for different units of the annunciator. Any help would be appreciated.  Thank you.
    Attachments:
    basic_serial_read.vi ‏100 KB

    What is the definition of the End Word?  You will likely need to figure this out experimentally (the manual doesn't seem to define it).  Whatever it is, you should set that as the termination character and enable the termination character.  That will help you in keeping your messages in sync.  Just tell the VISA Reads to read more than a message should be, something like 30 should work nicely.
    The error you are seeing is a buffer overload.  This means that the instrument is sending data to you faster than you can process it.  So you need to figure out how to perform the read faster.  File IO is slow.  So you should put that into a seperate loop so that your loop does nothing but read the data from the port as quickly as the data comes in.  Use a queue to send the data from the reading loop to the logging loop.  This is known as a Producer/Consumer.
    And here is a cleaned up version of your code.  No need for your express VI or the formula node.  Some other general cleaning up also done to make it easier to read.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    serial read.png ‏80 KB

  • Strip Characters from String?

    Hi,
    How can I strip off some characters from the end of a string?
    I am not very good at regular expressions but perhaps I may not
    need one? Here is the data
    first_name_510
    last_name_2267
    I need a function that will strip off everything from the
    right including the underscore. I should be left with the below:
    first_name
    last_name
    Any help highly appreciated
    Regards

    if it is always an underscore, and always the last one, this
    should do
    the trick:
    #left(string, len(string)-len(listlast(string, "_"))-1)#
    string is assumed to be the variable holding your text
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/

  • Increasing currency from 2 to 3 decimal points

    Dear all,
    I would like to know how to make the currency view in the expense report increased from 2 to 3 decimal points as km/miles rate we have here is $0.335  per mile.  Also the USD is used for 5 other countries.  As of now it is showing as 0.34, however this is a manipulation of actual data, Ex. for 10 kms it shows rate 0.34 x miles 10 = $3.35.
    Any quick response would be of great help.
    Regards,
    LN Bhattacharya

    Yes this is a known issue as the problem is, that the USD is a currency with 2 decimals, but government allowes to reimburse 0.375 USD taxfree. The output on the travel form is in a single currency: the USD with 2 decimals. One workaround is to create a currency USDN for the decimilisation to work with 3 places - see the note 446116
    A single expense category like miles per diems is calculated in accounting program RPRTEC00 and stored in one table (PAUFA for miles).
    If currency in T706F (USDN) differs from trip currency (USD), RPRTECC00 converts the amounts from T706F into trip currency (done by FI-function 'CONVERT_TO_LOCAL_CURRENCY'). Amounts in the list are presented in this trip currency but rounding is possible with adjustment in V_T001R as PREC can handle this conversion with factors defined here.
    Hope it helps!
    Thanks
    Sally

  • UCCX scripting change decimal symbol from point to comma

    Hi all,
    I have an UCCX 7.0 SR5 deployment. I have some HTTP script to which I am passing some variable with the HTTP Contact Info. My scripts are accepting floats only if the decimal symbol used is a point. I would like to change this behaviour so that my scripts could accept floats with a comma instead.
    Best Regards,
    Hatem Hamdi,

    This problem cropped up with the advent of OS X. Prior to that the period (under the 3 on the right hand end of the big keyboard) worked as a decimal point and could produce a point or a comma depending on what language you were working with. Nowadays it doesn't work like that and no amount of fiddling with languages will get it to do things right. So now you either have to use the period (two spaces to the left of M) when entering measurements or else hold down shift when using the decimal period. It's a nuisance and takes a bit of getting used to. Incidentally the decimal period works right in the Calculator but for some reason not in Illustrator. Here in Iceland we use commas for decimals but have to enter periods for Illy measurements.
    The trick that I use for converting points to commas and vice versa in balance sheets in annual reports and that sort of thing is this: First step - Use Edit : Find and Replace to select all the commas and change them to some obscure character that is not used elsewhere.
    Second step - Select all the periods and change them to commas.
    Third step - select all the "obscure characters" and change them to periods.
    I haven't found a better way than this 3-step method but any other suggestions are more than welcome.

  • How can I add a decimal in a string?

    Hi,
    I try to make a function to insert a decimal point after the 3rd position in a string if length of that string is >= 4
    I try as belows:
    If LENGTH(str) >= 4 THEN
    rdstr := SUBSTR(str, 3);
    ldstr :=
    TRIM(TRAILING rdstr FROM str);
    str := CONCAT(CONCAT(ldstr, '.'), rdstr);
    Is there any other better way to this that can save DML actions?
    Thanks a lot!
    null

    If length(str) > 4 Then
    str:= substr(str,1,3)&#0124; &#0124;'.'&#0124; &#0124;substr(str,4,length(str)-3);
    End If;
    null

  • Comma instead of decimal point

    Is there a global way to doubles and floats to use a comma instead of a decimal point (like we do in Europe) when output as a string? (as opposed to having to reformat each number individually every time I want to display it)

    Kramis wrote:
    Thanks. Writing code internally is no problem with a dot. Will the locale of my computer determine the string output style automatically?I'm not sure what exactly to change on your PC to make that happen, but yes, I believe you can do this. This varies on every OS, of course, but you should look into your OS's country- and/or location settings.
    Kramis wrote:
    ... but then I assume I have to use it every time I output to a string with each individual number.That is correct.
    Kramis wrote:
    ... I was hoping for a more global method.You could place the formatter(s) in a separate class and invoke them from there: no need to create new formatter(s) every time you want to display a number. But you will have to do yourFormatter.format(aDouble) every time though.

  • How to get values after decimal point

    Hi,
    source value is 12345.678 i wana the target side in 12345  in field and 678 in one field.
    the source value its not fixed  before decimal point value pass to one field and after decimal point value pass to other field
    please help to me how to do this one.

    Hi Swathip,
    You dont need to create 2 UDFs. You just need to create 1 simple UDF which takes one string array as input as usual and it has 2 Resultlist outputs. You need to map this 2 outputs from the UDF to the respective 2 target side fields where the values are to be mapped, one containing the portion before the decimal, and one after the decimal.
    I HAVE TESTED THE UDF AND IT WORKS ABSOLUTELY FINE.
    THE CODE FOR THE UDF IS AS FOLLOWS:
    public void sepDec(String[] num,ResultList wholeNum,ResultList afterDec,Container c)
      String part1=null;  // Stores the part before the decimal point
      String part2=null;  //Stores the part after the decimal point
                            if(num[0]!=null && num[0]!=""){
                   int index = num[0].indexOf(".");
                   part1 = num[0].substring(0,index);
                   part2=num[0].substring(index+1, num[0].length());
                         wholeNum.addValue(part1);
                   afterDec.addValue(part2);
    THIS UDF IS A CLASSIC EXAMPLE WHERE AN UDF HAS 2 OUTPUTS, WHICH IS VERY RARELY SEEN BUT VERY MUCH CORRECT
    PLEASE LET ME KNOW IF THIS CODE WAS HELPFUL TO YOU
    CHEERS,
    BISWAJIT
    Edited by: 007biswa on Feb 8, 2011 5:02 PM

Maybe you are looking for

  • Closing Unwanted Open Apps

    I wanna know what do i do to close open apps such as chat,watsapp..bucz i thought not being them means thewre closed. Buh wen i wanted to go on my mail it said to much opened apps, then it showed me all that was open an choose one. So i wanna know ho

  • Windows 7 64 bit intel hd 3000

    İs there driver for intel hd 3000 for windows 7 64 bit bootcamp in my mac it seems my graphic card is 256 mb so ı'm only using amd 6490m ı installed bootcamp driver cd but it didn't solve the problem how can ı use intel graphic driver too?

  • Trouble syncing iPod (Click Wheel)

    I have a iPod click wheel and I tried to sync my iPod one day and I received the following message, "iPod cannot be syncd as required folder could not be found". Message does not specify what folder. I have reset the Ipod, tried restore. I called iPo

  • Problem with dual graphic

    I own HP PAVILION G6 1202TX model.It is built with dual graphics INTEL and RADEON. INTEL - INTEL(R) HD Graphics 3000 and AMD- RADEON(TM) HD 6470M.earlier accidently i lost my windows and its all drivers but my main issue is with ts graphics.If i inst

  • "All purchases have been downloaded for this Apple ID." What does this mean?

    I must be misunderstanding what this means. I assume that when I choose the menu item Check for available downloads... it will find things in the store that I have purchased, but not downloaded. For example I subscribe to Justified and Better Call Sa