Millisecond Forums

Capitalize Function

https://forums.millisecond.com/Topic16791.aspx

By jfanderson - 7/24/2015

Just a note - it appears that the capitalize function only makes the first letter uppercase if it was previously lowercase. If a user enters text that is in all caps (e.g., "BOB"), the capitalize function, in my experience, retains the entire text as all uppercase. 
By Dave - 7/24/2015

That is correct. If this undesirable in your paradigm, convert the response to all lowercase first, then capitalize:

<values>
/ a = ""
/ b = ""
</values>

<block myblock>
/ trials = [1=sequence(myopenended, mytrial)]
</block>

<openended myopenended>
/ ontrialend = [values.a=capitalize(openended.myopenended.response);
    values.b=capitalize(tolower(openended.myopenended.response)); ]
</openended>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("<%values.a%> | <%values.b%>")
</text>