0 Replies Latest reply on Mar 30, 2007 7:16 AM by sirrahe

    Input text strings

    sirrahe Level 1
      I am simulating for a client the search function of a database. One functionality that they have in the database is to enter a wild card character (*) after a minimum of three characters.
      searching for name "jones" the user could input "jon*".
      So I need to determine first if there is a wildcard in the last position of the string.
      so I thought I could first define the wildcard position variable, determine what the last character is, if it is in position 3 or greater and is an asterisk, then I could go ahead and process the search. If it is an asterisk and in position 2 or less, I need to display error message.
      //determine position of last character in string and assign to variable.
      var wcPosition:number = custLastName.length-1;
      //assign character to variable
      wc:string = custLastName.charAT(wcPosition:number );
      //Check if wildcard character is "*" in position 3 or greater
      if (wc=="*" && wcPositionNumber >=3){
      if (wc=="*" && wcPositionNumber <3){
      Now for the searchPartial().
      If the first part above is correct,
      I need to check that the characters before the wild card are equal to the stored variable for the customer name.

      Am I on the right track and how do I compare the number of characters before the wildcard with a name stored in a variable?