I am creating labels dynamically and I want to know the number of digits entered in the label so that I can create new labels of that number. i.e. if the digit in the label is "67453848" then I have to get the number of digits in this label here it is "8".
Thank you
you looking for
label.text.length;
Use this:-
NSLog(#"%d",yourLabel.text.length);
Related
I am using the following custom formula in conditional formatting to try and highlight the 5 lowest values in column B. However, I would like it to exclude zero values from the data. How do I highlight the lowest 5 values that are greater than zero?
=$B1<=SMALL($B$1:$B$100,$E$2)
Thank you!
https://docs.google.com/spreadsheets/d/1K-dsv3bB1qF-zhPR1XtciHmQAdOMuzrUJU4SlXz5e08/edit?usp=sharing
You can filter out the zeros before using SMALL, like this:
=AND($B1,$B1<=SMALL(FILTER($B$1:$B$100,$B$1:$B$100),$E$2))
Just an alternative added in this tab here:
highest
=xmatch($B1,sortn(filter($B:$B,$B:$B<>0),$E$1,,1,))
lowest
=xmatch($B1,sortn(filter($B:$B,$B:$B<>0),$E$2,,1,1))
For designing purposes, I need to know the minimum and maximum possible text from a paragraph. I've added an image below to show you what I try to achieve. A:6 has the minimum characters (2) whereas A:4 has the most characters (30). On B:4 I want to display the min-max range.
I've been looking and trying formula's, but none working so far. Does anyone have a solution? Thank you kindly in advance!
use:
=INDEX(MIN(LEN(FILTER(A2:A, A2:A<>"")))&"-"&MAX(LEN(A2:A)))
Use:
=max(ArrayFormula(len(A4:A7))) for maximum
=min(ArrayFormula(len(A4:A7))) for minimum
Or if you want to have everything in one cell, you can try:
="Text length range "&min(ArrayFormula(len(A4:A7)))&"-"&max(ArrayFormula(len(A4:A7)))&" characters."
I have this list of numbers. I applied a custom number format to it. It's just colon and dot(not decimal point). My goal is to highlight the lowest number there. I'm convinced that my idea of "Is equal to min(A1:A19)" is correct but the result... Any idea why is it highlighting 4 cells and how can I reach my goal some other way?
I first edited player0's answer in order to add some explanation for this issue, but since the edit was rolled back, I'm posting this answer for documentation purposes.
Issue:
The conditional formatting is highlighting the minimum value starting from current row, not from A1. For example, A10 is the minimum value in the range A10:A19, so it gets highlighted.
Solution:
Add the $ operator to the formula:
=MIN(A$1:A19)
Or set Format cells as Custom formula is and set your formula to:
=A1=MIN(A$1:A19)
try:
=MIN(A$1:A19)
or: like this and set it as custom formula:
=A1=MIN(A$1:A19)
I want cell A4 to show the number in cells A1:A3 that is closest to zero, including if that number is negative, and where some of those cells may contain "na".
I've tried MIN with ABS but that can't handle the "na".
many thanks in advance.
B
=ArrayFormula(min(iferror(abs(A1:A3))))
If you wanted to find the original value with its sign (+/-), would need something like
=ArrayFormula(index(A1:A3,match(min(iferror(abs(A1:A3))),iferror(abs(A1:A3)),0)))
Please try:
=min(ArrayFormula(if(isnumber(A1:A3),abs(A1:A3))))
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.