This conversation has been locked due to inactivity. Please create a new post.
This conversation has been locked due to inactivity. Please create a new post.
Hi,
We would like to use the 'toProperCase' function on the <%= recipient.preferredName %>
But unsure of how to format it? Please could someone help!
Thanks,
Tutu
Solved! Go to Solution.
Views
Replies
Total Likes
First define the function like this
<%
String.prototype.toProperCase = function() {
var words = this.split(' ');
var results = [];
for (var i = 0; i < words.length; i++) {
var letter = words[i].charAt(0).toUpperCase();
results.push(letter + words[i].slice(1));
}
return results.join(' ');
};
%>Then you can use it like this
<%= recipient.preferredName.toProperCase() %>
First define the function like this
<%
String.prototype.toProperCase = function() {
var words = this.split(' ');
var results = [];
for (var i = 0; i < words.length; i++) {
var letter = words[i].charAt(0).toUpperCase();
results.push(letter + words[i].slice(1));
}
return results.join(' ');
};
%>Then you can use it like this
<%= recipient.preferredName.toProperCase() %>
Could also do something like this... (The joy of JavaScript, 1000 ways to do the same thing!)
<%
function nameProper() {
var name = recipient.firstName;
var propName = name.chartAt(0).toUpperCase() + name.slice(1);
}%>
Dear <%= nameProper %>,
Dear <%= nameProper %>,
Hi @Tutsaa ,
You can use a simple version also:
<%= recipient.preferredName.substring(0,1).toUpperCase()+ recipient.preferredName.substring(1,100).toLowerCase() %>
Thanks,
Jyoti Yadav
Views
Likes
Replies
Views
Likes
Replies