So in the leaderboard I have cash, exp, etc. But I also want to have a "Title" option, the thing is that if I want to change the stat, I dont know how to change it to words instead of numbers, can anyone help me?
What you'd be looking for is a StringValue. These can store strings of text instead of numbers, booleans, etc.
local stringValue = Instance.new("StringValue", [player].leaderstats)
stringValue.Value = "Your text here"
Related
The title says it all. One thing I want to avoid is long formulas. If it's more than a single function, something is clearly wrong since this should be a common use case.
I've tried TO_PURE_NUMBER and VALUE
Your question suggests that the value $71.4145 is not a number but a text string. That can happen if your spreadsheet locale is such that it expects comma as decimal mark, or expects a different currency symbol. It will also happen if you have formatted the value as plain text rather than currency.
To convert the text string $71.4145 into the number 71.4145 (seventy-one and change), use regexextract(), like this:
=iferror( value( regexextract( to_text(A2), "[\d.]+" ) ) )
Just use -- to suppress text to equivalent number values. Try-
=--A1
try:
=SUBSTITUTE(A1; "$"; )*1
I need a Google Sheet function that will return the position of the last instance of a particular character. Basically, FIND, but starting on the right.
For example, for the data set below, I need to return the position of the last dash.
ABC-DEF-GHI = 8
ABCD-EF-GH-IJK = 11
AB-C-DE-FGH-I-JK = 14
Thanks!
I don't know where to start. MID might work, but the file names are of different lengths and different formats. The files just generally end with - ***.png, and I need the asterisk. The string I need is also of variable length and can contain spaces (the string is the name of the student).
Here's a possible solution:
=len(regexextract(A1,".*-"))
It's essentially extracting everything up to the last dash and taking the length of the resulting string.
for the whole array try:
=INDEX(LEN(REGEXEXTRACT(A1:A3; "(.*-)")))
How can I check what exactly and where a string changed in my textfieldDidChange method?
let str1 = "Hello how are you #Marie, nice day uh?"
So imagine my user decides to edit the text and link markus instead of marie
let str2 = "Hello how are you # Markus, nice day uh?"
I need a method that detect the change of # Markus in the text field but doesn't change anything else in the string.
I am able to detect last word, first word and so one, but its important to also see what changed within the text
i am thinking about a method that
a = "Hello how are you"
b = newly changed text field
c = ", nice day uh?"
let str3 = a + b + c // More or less
Maybe that I get the index where I am editing at, taking the word out at this index - from left space to right space - and cutting it out?
Thanks in advance, yes I am a beginner :P
If you set your view controller up to be the delegate of your text field, you can implement the textField(_:shouldChangeCharactersIn:replacementString:) delegate method. That will tell you the range of characters that the user has asked to change, as well as providing the replacement string.
You could use that to monitor the user's edits. However, the string can easily get changed in a way that is difficult to track. What if the user deletes the "Hello how are you " part? What if they replace the whole string with "Shut your festering gob #fred, you malodorous pervert"?
You're probably better off getting the whole string from the text field and parsing it. You could accept anything the user enters, an look for and # sign, and take everything after that until the next space as the name, e.g. #alphanumerics`
Edit:
Alternately, you could set up your screen so the first part is a label, the middle part is an editable text field, and the last part is another label. The only part the user is able to edit is the middle part, the name. Or you could make it 3 separate text fields, the prefix, the name, and the suffix. Tell the user what you expect them to enter into each part.
You can split your string using this code.
For Objectve c :
1. Create function like this.
-(NSString *)checkString:(NSString *)splitString{
NSRange firstObj = [splitString rangeOfString:#"#"];
NSRange secondObject = [splitString rangeOfString:#","];
NSRange rangeSubStr = NSMakeRange(firstObj.location + firstObj.length, secondObject.location - firstObj.location - firstObj.length);
return [splitString substringWithRange:rangeSubStr];
}
2. Use this function like this.
[self checkString:#"Hello how are you #Marie, nice day uh?"]
Then every change in text, you can check substrings, and compare them to original substrings.
I'm trying to write a string that can cover off all text in B1:B15 but get stuck when comes to adding beyond the first part which I can get to work.
I have this so far =IF((B17=B1),"North")
I then want to continue so covers off B1:B8 as North and B9:B15 as South based on selection made
Example
Your question title says you want to see 'True' or 'False' in C17 depending on whether or not the value in B17 is in the list B1:B15. Try this in C17:
=NOT(ISNA(VLOOKUP(B17,B1:B15,1,FALSE)))
If instead of just getting true/false you want to return the value in column C depending on which value was matched in column B then you would use:
=VLOOKUP(B17,B1:C15,2,FALSE)
I don't quite understand what you're asking because your example image has nothing in B17.I assume you're writing your equation in C1?
If I'm following what you're asking, what you actually probably want to do is, in C1:
=IFERROR(VLOOKUP(B17,$B$1:$C$15,2,0),"Not found")
Then fill that equation down as far as you need to go in column C. The iferror means if the vlookup fails to find something, it'll display that message, which you can make whatever.
I will follow your logic
=IF(COUNTIF(B1:B16,A17)>0,"True","false")
"If the number of coincidences of A17 in the range B1:B16 is bigger than 1 then 'True', else 'false'"
This question already has answers here:
UITextView change text color of specific text
(3 answers)
Closed 7 years ago.
I have an iOS Swift 2/Xcode 7 project that searches a string and identifies substrings from a specified list. The input string will change, but the substrings remain the same.
Something like this
inputString "SALT, WATER, FLOUR"
Comparison substrings "SALT, PEPPER"
Since "SALT" is present, it would become highlighted to look like this
SALT WATER FLOUR
and ideally in a different color - so Red for "SALT", Green for "PEPPER", anything else would be black.
Here is the basic code for searching for the substrings -
iList = "SALT, FLOUR, WATER...." //actually pulled from CORE data, different for every search
for ingredient in ["SALT", "PEPPER", "SUGAR"] {
if iList.rangeOfString(ingredient) != nil {
print("Ingredient Found \(ingredient) found")
}
}
The iList is displayed in a TextView.
The desired result would look something like
SALT, FLOUR, WATER....
The examples I found relied on being able to change text colors at specific positions within the string. In this case, the location of a substring (if present) will vary for every use.
Help with this would be greatly appreciated.
Thank you.
You need to use NSAttributedString for this purpose.
Check out this post:
http://ramezanpour.net/post/2014/01/28/customize-your-texts-in-ios-using-nsattributedstring/
Use substringWithRange method to find the range of the string that you need to make bold or change color and then use the returned range as shown in the tutorial.