ios localized first character as section name - ios

I have been searching hours...
I wanted to implement section names with localized first letters as if apple's Contacts App.
If my phone setting is localized, that string will be in seperate section. if not it will be merged in related US characher.
In example,
In English settings: Ömer,Özgün,Orhan,Özüm will be in "O" section sort results in: Ömer,Özgün,Özüm,Orhan
In Turkish settings: Ömer,Özgün,Özüm will be in "Ö" section and Orhan will be in "O" section.
I have tried this: How to use the first character as a section name
and many others...

Try UILocalizedIndexedCollation.

Related

Google Sheets conditional formatting a row based on finding either of two words in a string

Users are able to enter a string into a cell. If the string contains either the word "Letter" and/or the word "Note", the entire row needs to turn red. These words are not case sensitive. I can create two conditional formats for the same row but would prefer one that looks for either word. One person had me try =OR(SEARCH(“LETTER”,$M6),SEARCH(“NOTE”,$M6)) in the "Conditional Formula_ Custom Formula is", it did not work. This works for the word "letter" in a string: =SEARCH("LETTER",$M6). This works for the word "note" in a string: =SEARCH("note",$M6). I would like to put them into one statement.
try:
=REGEXMATCH($M6, "(?i)LETTER|NOTE")

Google Sheet: How to search & extract specific value from a long and multiple line of texts in single cell

Hello and good day everyone!
I need your help and advise, i've one set of table and data as per below, and i'd like to use a formula to extract specific value from a single cell by using some value as indicator to indicate which text's line to extract.
Given the sample table as below,
Column A
Column B
Column C
This is example of the long texts value with multiple linethis text is very long also included value as below,Company: Apple IncContractor name: John Wick the value above, is per line.. and this text continue.. continue text..example text again..
This is where i'd like to display the Company name extracted from Column A
This is where i'd like to display Contractor name extracted from Column A
Example of what i want to achieve,
Column A
Column B
Column C
This is example of the long texts value with multiple line this text is very long also included value as below,Company: Apple IncContractor name: John Wick the value above, is per line.. and this text continue.. continue text..example text again..
Apple Inc
John Wick
I've tried with
LEFT()
MID()
=LEFT(A2,SEARCH("Company",A2)-1)
=REGEXREPLACE(A2,"(.*)Company(.*)","$2")
with no success.
May I request your advise and help on this please!
Thanks in advance.
In your situation, how about the following sample formula?
Sample formula:
Retrieve "Company name".
=TRIM(REGEXEXTRACT(A1,"Company:(.+)"))
Retrieve Contractor name
=TRIM(REGEXEXTRACT(A1,"Contractor name:(.+)"))
Testing:
When these formulas are used, the following result is obtained.
Note:
For example, the base data is put to the cells "A1:A3", you can also use the following formulas.
=ARRAYFORMULA(TRIM(REGEXEXTRACT(A1:A3,"Company:(.+)")))
=ARRAYFORMULA(TRIM(REGEXEXTRACT(A1:A3,"Contractor name:(.+)")))
Reference:
REGEXEXTRACT

Is there code that can force a user to enter a particular format into a cell?

I have a Google Spreadsheet.
Google Spreadsheet
When users enter a name into any cell of column A of the sheet named "Unit Standards" I want them to enter that name in a particular format. That is, with the surname first in uppercase then a comma, then the first name in title case then if they are known by a different name that name to be title case in brackets e.g.
BUSH, George
TRUMP, Donald
CLINTON, William (Bill)
CARTER, James (Jimmy)
SMITH-JONES, John
ZETA-JONES, Catherine (Kate)
Is there a way to force them to do that before they leave the cell or the sheet?
You could use a script. Still.
You can have the same results with a simple formula using Data Validation on column A.
This is the formula to put in cell A2 for the range A2:A555:
=REGEXMATCH(A2,"^[A-Z]+\b[',']\s[A-Z]{1}[a-z]+\b(\s([A-Z][a-z]+\b))?$")
Reading the regular expression:
^[A-Z]+\b[',']\s[A-Z]{1}[a-z]+\b(\s([A-Z][a-z]+\b))?$
^[A-Z]+\b: In the beginning have only 1 or more capital letters until the end of the word
[',']\s: Have a , followed by an empty space
[A-Z]{1}[a-z]+\b: Have only 1 capital letter and 1 or more small letters till the end of the word
(\s\([A-Z][a-z]+\b\))?$: All of the above could be followed ? by this string.
\s\(: An empty space and an opening parenthesis (
[A-Z][a-z]+\b: A word starting with just 1 capital followed by 1 or more small letters
\): A closing parenthesis
$: End of string

Google spreadsheet text length validation

I am working on Google spreadsheet. I am trying to make a validation rule on the text length.
For example the text length must be equal to 12 characters which includes number, on dash and one capital character.
Example:
123-56C89112
I tried to search in google groups but no result! can you help in this please
You can use Data > Validation > Custom Formula is
=REGEXMATCH(B3, "^(?=.{12}$)(?=(^[^A-Z]*[A-Z]{1}[^A-Z]*$))(?=(^[^-]*[-]{1}[^-]*$)).*")
I'm not an expert on Regex so this may be a bit over the top, but it appears to work:
^(?=.{12}$)(?=(^[^A-Z]*[A-Z]{1}[^A-Z]*$))(?=(^[^-]*[-]{1}[^-]*$)).*
Debuggex Demo
This allows any string with exactly 12 characters, 1 upper case letter and 1 dash.
EDIT: The (Lookahead) Regex doesn't seem to work in Spreadsheets (see comment)
EDIT2: Using a custom function like the following seems to work, but only if you use warnings (instead of rejections) for some reason (bug?)
function test(myString) {
return myString.match("^(?=.{12}$)(?=(^[^A-Z]*[A-Z]{1}[^A-Z]*$))(?=(^[^-]*[-]{1}[^-]*$)).*")!=null;
}

Google Spreadsheet, Count IF contains a string

I have a column like this:
What devices will you be using?
iPad
Kindle & iPad
No Tablet
iPad
iPad & Windows
How do I count the amount of people that said iPad?
This formula does work for exact matches but not if it contains an additional value:
=(COUNTIF(A2:A51,"=iPad")/COUNTA(A2:A51))*1
Any Suggestions?
It will likely have been solved by now, but I ran accross this and figured to give my input
=COUNTIF(a2:a51;"*iPad*")
The important thing is that separating parameters in google docs is using a ; and not a ,
In case someone is still looking for the answer, this worked for me:
=COUNTIF(A2:A51, "*" & B1 & "*")
B1 containing the iPad string.
You should use
=COUNTIF(A2:A51, "*iPad*")/COUNTA(A2:A51)
Additionally, if you wanted to count more than one element, like iPads OR Kindles, you would use
=SUM(COUNTIF(A2:A51, {"*iPad*", "*kindle*"}))/COUNTA(A2:A51)
in the numerator.
Try using wildcards directly in the COUNTIF function :
=(COUNTIF(A2:A51,"=*iPad*")/COUNTA(A2:A51))*1
Wildcards worked for me when the string I was searching for could be entered manually. However, I wanted to store this string in another cell and refer to it. I couldn't figure out how to do this with wildcards so I ended up doing the following:
A1 is the cell containing my search string.
B and C are the columns within which I want to count the number of instances of A1, including within strings:
=COUNTIF(ARRAYFORMULA(ISNUMBER(SEARCH(A1, B:C))), TRUE)
I had similar problem however the various count solutions still wouldn't work even with wildcards of "*"& etc..... My problem was caused by &nbsb (hidden spaces) which is hidden in the background when copying eg data from a webpage. This prevents the find from working properly. Use:
=TRIM(SUBSTITUTE(A2, CHAR(160), " "))
or
=TRIM(SUBSTITUTE(A2,CHAR(160),CHAR(32)))
or similar to get rid of them.
Try just =COUNTIF(A2:A51,"iPad")

Resources