These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Returning the first letter

kenjoly
Registered: Jun 5 2008
Posts: 4

Is there a way in Acrobat 8 Pro to return the first letter of a word. It would be the same as Excel's LEFT function.

Thanks!

Ken

My Product Information:
Acrobat Pro 8.1.2, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
You can use the JavaScript "cahrAt(index)" method, the "split([ separator][, limit])" method, or the "substring( indexA, indexB)" method. All of these methods are ECMA version 2.62 compliant.

A sample script that can be run in the JavaScript console:

var myString = "ABCD is a test string";
var firstLetter = myString.charAt(0);
console.println("charAt(0) = " + firstLetter);
firstLetter = myString.split('',1);
console.println("split('',1) = " + firstLetter);
firstLetter = myString.substring(0,1);
console.println("substring(0,1) = " + firstLetter);

If you wanted to write your own LEFT funciton use the "substring()" method.

George Kaiser