Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Return the nth character of a string

  • Glottis
  • Glottis's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 2 months ago #180069 by Glottis
Return the nth character of a string was created by Glottis
Hi,

This is probably a simple one but I couldn't find anything in the documentation that mentions it.

How would you return a specific character from a string in an equation question? As an example; a survey respondent enters their name in the fields with the codes {firstname}{middlename}{lastname} and from these completed fields we want to return their initials (first letter in each name) in the equation field?

Many thanks in advance!
The topic has been locked.
  • Glottis
  • Glottis's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 2 months ago #180071 by Glottis
Replied by Glottis on topic Return the nth character of a string
Nevermind! It's just regular old substr.

So for this example it would just be;

{substr(firstname,0)}{substr(Q00006,0)}{substr(Q00006,0)}
The following user(s) said Thank You: DenisChenu
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose