First character from a string

First character from a string

To capture the first value of a string in a Confirmit script node, use the script below.

var str : String = f(“qnr_new_details_1“).get();
var firstLetter : String = str.charAt(0);
var suranmeinital = (f(‘qnr_new_details_2‘) + “, ” + firstLetter);

surnameinitalout.set(suranmeinital);

This is taking 2 values (First name and surname) and making the out to be “Surname, Firstname Inital” “Smith, B” / “Miller, C” (Chris Miller)