View Full Version : Dealing with a name that ends in "s".

Tony Olivas
January 23rd, 2012, 02:46 PM
Hello all,

I'm looking for Script that deals with a first name that ends with an S.

I want to add just an apostrophe if the name ends with S.

Else return apostrophe S.

For example First Name is James. Return James' (possessive).

Else return "'s". For example Tony's.

Thanks in advance

January 23rd, 2012, 04:15 PM
var str = Field("First Name");

if (str.substr(str.length -1, 1) == "s") str += "'";
else str += "'s"

return str;

Tony Olivas
January 24th, 2012, 06:41 AM
Thanks Thomas! That worked perfect.

Once again this forum never disappoints!:D