function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CageMMACageMMA 

TextBox Area Code Logic?

Hi:

  If I have a textbox area and have 3 names in it, each name followed by a comma... How can I count the number of names that are in this box?

For example:

a,b,c <==3 names

 

Anyone have any ideas?

WizradWizrad

Just use the methods available to you on the string object.  Lets say your text area is bound to the string "tBox".

 

public Integer getNumNames() {
  if(tBox != null && tBox.trim() != '') {
    if(tBox.contains(',') {
      return tBox.split(',').size();
    } else {
      return 1;
    } 
  } else {
    return 0;
  }
}