IOS: take a double value without two digits after the decimal point - ios

I have a text field where I write a number; if I write inside this textfield a number without decimal point, I want to take this value and add a decimal point and two number after it
if I write (in textfield) "1" , I want to add ",00" then it becomes 1,00
if I write "1,8" , It becomes : "1,80"
or
if I write "2,86", It don't change : "2,86"
when I solve it I want to add this value in an array.

You should have a look into NSNumberFormatter.

Related

Google Spreadsheet - How to split delimited text into columns without format conversions (i.e. preserve raw text)

Say...
cell 1 contains this text: 03400561, 1995-12-31
I need a way to split this cell into 2 raw text columns". i.e.
My expected/wanted output: cell 2 = 03400561 (as text) and cell 3 = 1995-12-31 (as text)
If I use the split function to do this (e.g. cell 2 = split(cell1,",")), it removes leading zero, and convert the yyyy-mm-dd text into a google date. I do not wish to have this conversion to take place. i.e. I just wanted straight and simple split a text, into columns of text (not numbers. not dates).
How do I do this out of the box? (I've tried google around but no luck). Is this even possible?
Side note: the "Data" => "Split text into columns" approach - no luck. It converts all numeric-like texts into numbers, and date-like texts into dates. I wish to have raw text throughout and no conversion like this to happen. How to do this?
Ugly as hell, but seems to work on your example. Basically enclose the separator with double quotation marks to force sheets into interpreting the data as text. Then remove them and use arrayformula() to cover all the columns:
=arrayformula(substitute(SPLIT(char(34)&substitute(U19,",",char(34)&","&char(34))&char(34),",",true,false),char(34),""))
CHAR(34) evaluates to double quotation (i.e. ") to signify text entry. Just be aware that the second variable includes a leading space (' 1995-12-31')

google sheet, position of first number in a string

BJ190215P00020000
this is the string. I want to extract the left letters "BJ" (they are from 1 letter up to letters).
I think i need to find the position of the first digit, then apply LEFT function to get out the "BJ". (the letters could be 1-8).
is there a way to find the position of first digit in the string. OR, is there a better way to extract the letters before the first digit?
Try ...
=regexextract(A1,"\D+")

If string contains statement - Swift 2 Xcode 7

I am using the Xcode 7 beta 5 and Swift 2. I currently have a UITextField and a UIButton. The UITextField is set to a decimal pad, but however, the user is able to enter in multiple decimals. That is not how I would like the app to work. I would like to check, when the button is tapped, if the text field has 0-1 decimal points. Is there any statement that checks for multiple decimal points?
Replace textField with a reference to your UITextField in this:
if textField.text.componentsSeperatedByString(".").count >= 3 {
// more than 1 decimal point
}
This seperates the text in the text field into an array and creates an array of strings separated on any decimal points. If there are 0-1 decimal points, the array will have less than 3 items. This documentation might be helpful.
Give the text field a delegate and implement textField:shouldChangeCharactersInRange:replacementString: to prevent the user from entering a decimal point if there is already one present.

How to format y values in a tool tip to show commas?

I am using HTML to display values in my shared tooltip. I am using html so as to align my numerical values for both my series to right. Not sure if there is any other way. But the number values in the tooltio appear to be seperated by decimal points. Is there a way to have comma seperated values in the tooltip. Something like (123,123,123) ?
Yes, you can set it with the thousandsSep. It defaults to , so you may have a different language setup that is forcing ..

HighCharts - compare series with values instead of percentage

Just a simple answer needed, is there a simple way to compare a series on values rather than percentages? Something like "compare : 'values'" rather than "compare : 'percent'" or do I manually have to add data points for given time intervals? Thanks!
Yes, but the option is called value
From the plotOptions.series.compare documentation:
compare: String
Compare the values of the series against
the first value in the visible range. The y axis will show percentage
or absolute change depending on whether compare is set to "percent" or
"value". When this is applied to multiple series, it allows comparing
the development of the series against eachother. Defaults to
undefined.
The demos from the documentation: Setting compare to percent, value.

Resources