I saw here in the doc that there is a placeholder notation like:
"El valor mínimo para este campo es de {0}"
But I didn't find the function that will do the replacement. I expect a function similar to sprintf in php to exist which allow to replace these strings like:
function_Im_looking_for("El valor mínimo para este campo es de {0}", 10);
that returns the string "El valor mínimo para este campo es de 10".
How can that replacement be achieved.
Ext.String.format('Hello {0}', 'Foo');
It's worth noting that it doesn't attempt to do any formatting, just simple replacement. So you can't do something like {0:d/m/Y}
Related
I'm trying to learn how to filter out nested dictionaries in the MongoDB database. All documents have the same structure as this example which I will try to get:
I try to obtain the document thanks to the Name which is 'My Burberry - Eau de Parfum':
{ "q0.Results": {"Name":"My Burberry - Eau de Parfum"} }
But it doesn't give me anything back:
What you are doing:
{ "q0.Results": {"Name":"My Burberry - Eau de Parfum"} }
says find me documents where q0.Results is exactly like this document/subdocument: {"Name":"My Burberry - Eau de Parfum"}
In the arrays, you just need dot notation and the following should give you the result:
{ "q0.Results.Name": "My Burberry - Eau de Parfum" }
I'm trying to get an array with the following output:
["", "7", "02156567848", "CORTIER EP. ENGERANT ROSE JOSE MARIE", "059 NOMBRE DE LA PERSONA ES DIFERENTE"]
But using next code the result is different, because split is considering any non word character to separate the strings.
a = " 7 02156567848 CORTIER EP. ENGERANT ROSE JOSE MARIE. 059 NOMBRE DE LA PERSONA ES DIFERENTE"
b = a.split(/\W\W+/)
p b
Output:
["", "7", "02156567848", "CORTIER EP", "ENGERANT ROSE JOSE MARIE", "059 NOMBRE DE LA PERSONA ES DIFERENTE"]
Any idea how to solve this?
Thanks and regards!
Split on \s{2,} -- two or more white-space characters.
a = " 7 02156567848 CORTIER EP. ENGERANT ROSE JOSE MARIE. 059 NOMBRE DE LA PERSONA ES DIFERENTE"
a.split(/\s{2,}/)
# => ["", "7", "02156567848", "CORTIER EP. ENGERANT ROSE JOSE MARIE.", "059 NOMBRE DE LA PERSONA ES DIFERENTE"]
repl
Search Term:
cristina de oliveira
This is the query:
(name_text:(cristina\ de\ oliveira^200.0 OR cristina\ de\ oliveira*^100.0 OR cristina\ de\ oliveira~^50.0))
This is the result:
MARIA CRISTINA DE OLIVEIRA,
LIA CRISTINA DE OLIVEIRA,
MARISA CRISTINA DE OLIVEIRA,
CRISTINA de OLIVEIRA
Problem:
Since search term is "cristina de olveira", the first result should be "CRISTINA de OLIVEIRA" and not "MARIA CRISTINA DE OLIVEIRA", how can I get exactly search term as the first result
I read a date from a SQL Server database through Entity Framework. I return the result to the web page and it's displayed like this :
Date(-658436400000)
I presume it's something about date format but all my attempt to resolve it lead to an exception.
Here the Entity Framework code in VB:
Public Function getEvenements(noFacture As String, bd As eFacturationEntities) As Array
Dim evenements As Array = (
From e In bd.ItemFactures Where e.NoFacture_cs = noFacture
Select e Select New With {
.noEvenement = e.NoEvenement_cn,
.depart = e.DetailFactures.FirstOrDefault.LieuPRCH,
.arrivee = e.DetailFactures.FirstOrDefault.LieuDest,
.nomBeneficiaire = e.Beneficiaire,
.NAM = e.DetailFactures.FirstOrDefault.NAM,
.dateDeNaissance = FormatDateTime(e.DetailFactures.FirstOrDefault.DateNaissance_dt),
.dateDeTransport = e.DetailFactures.FirstOrDefault.PRCH_dt,
.noAs811 = e.DetailFactures.FirstOrDefault.NoAS811}).ToArray()
Return evenements
End Function
Solution : call .toString on the date before sending it to the client.
.dateDeTransport = e.DetailFactures.FirstOrDefault.PRCH_dt.ToString,
But this solution may cause an Exceptionon on some case :
"LINQ to Entities ne reconnaît pas la méthode 'System.String
ToString()', et cette dernière ne peut pas être traduite en expression
de magasin."} System.Exception
(the french tradcution of VS is unclear ...)
I have a sql database with data about headers of news. Example:
id title
867 MPE consegue inverter julgamento
868 Defensoria P blica realiza licita
869 Prefeitos eleitos de todas as partes do Estado
870 Inc ndio deixa 80 pessoas desabrigadas
871 Carlos Amastha visita parlamentares
872 Defensoria P blica requer anula o
873 Marcelo Miranda diz que n o possui obriga o
874 Ex-assessor diz que Coimbra lhe deu dois cheques
I need to get each title and see if there are other news to talk about the same subject.
How i do it? My plataform is .Net and use sql server 2012.
You will probably want to put a Full-Text Index on this column and/or table. It's a complex subject, but you can start reading up on it here: http://msdn.microsoft.com/en-us/library/ms142571.aspx