1. Spliting Numbers Before Minus

hello,

help me to get value from 5000.75 to split and display in text box should be 500 only before .

please post if any solution for that .

2. Re: Spliting Numbers Before Minus

Your question is nonsensical. The title seems to suggest that you want to split on a subtraction operator but the question makes no reference to that, while the question suggests that you want to split on a dot but then uses an example that doesn't do that. It also isn't clear whether you're dealing with actual numbers, e.g. Double values, or Strings containing numerical characters. I suggest that you try again and, this time, provide a FULL and CLEAR explanation of the problem.

3. Re: Spliting Numbers Before Minus

Hi Yousaf,

Three days on and you've not replied to jmcilhinney ?
Maybe you've found an answer, in which case it would be polite to say so.

As John says, your question makes no sense, maybe there's a typo where you say '5000.75' and it ought to be '500.75' or perhaps the error is in '500' and ought to read '5000'.
To 'Split' a number as you try to describe, in it's simplest form only requires the use of an integer, i.e. a whole number without any fractions. You may want to make use of 'Math.Floor' if you don't want VB.NET to round-up the decimal part of your value.

Poppa.

4. Re: Spliting Numbers Before Minus

If it is '5000.75' or '500.75' and you really want the integral part...
If it's a string dim integralPart as integer = Cint('5000.75'.Split("."c)(0))

if it's a decimal dim integralPart as integer = CInt(Math.Floor(5000.75))

If it really is '5000.75' and the result you want from that is 500
dim integralPart as integer = Cint('5000.75'.Split(New String() {"0."}, StringSplitOptions.None)(0))

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

Featured