2
Hi, this is my first time in stackoverflow, and I’m having a hard time, I need to know how I can detect parts of a string, example:
String: "Definir a altura de %s para %d"
and I want the information %s and %d
Example:
"Definir a altura de objeto para 500"
Exit:
Saída: "objeto", 500
Is there any way to get that? NOTE: the output does not need to be necessarily in some kind of data, it can be output in 2 variables, 1 array or anything.
NOTE: Javascript Language.
Thank you.
You want to search a given word within a sentence and capture it?
– Jorge.M
Actually no, I need information that I don’t have, which can be varied, similar to a formatted entry
– hiperesp
the information will always be in the same place? If it is, you can create a function and pass two parameters, thus filling them in place of the string and then returning the same.
– Jorge.M
will be in the same place, but I get the full string from the user in this situation: User: "Set the object height to 500" Code returns: "object", 500
– hiperesp
It’ll always be that same phrase?
– Jorge.M
in this situation yes, but I will put more situations applying the same logic
– hiperesp