Changes between Version 2 and Version 3 of QuickStart/2:ModellingourApplication

Show
Ignore:
Timestamp:
04/27/09 14:36:35 (17 years ago)
Author:
cfgrok (IP: 64.30.223.5)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • QuickStart/2:ModellingourApplication

    v2 v3  
    1111 
    1212<cffunction name="init" returntype="any" access="public" output="false"> 
    13         <cfargument name="vowels" type="string" required="true" /> 
     13    <cfargument name="vowels" type="string" required="true" /> 
    1414 
    15         <cfset variables.vowels = arguments.vowels /> 
     15    <cfset variables.vowels = arguments.vowels /> 
    1616 
    17         <cfreturn this /> 
     17    <cfreturn this /> 
    1818</cffunction> 
    1919 
    2020<cffunction name="translate" returntype="string" access="public" output="false"> 
    21         <cfargument name="phrase" /> 
     21    <cfargument name="phrase" /> 
    2222 
    23         <cfset var firstVowel = reFindNoCase("[#variables.vowels#]", arguments.phrase) - 1/> 
    24         <cfset var result = trim(arguments.phrase) /> 
     23    <cfset var firstVowel = reFindNoCase("[#variables.vowels#]", arguments.phrase) - 1/> 
     24    <cfset var result = trim(arguments.phrase) /> 
    2525 
    26         <!--- We started with a consonant ---> 
    27         <cfif len(result) and firstVowel gt 0> 
    28                 <cfset result = right(arguments.phrase, len(arguments.phrase) - firstVowel) 
    29                         & left(arguments.phrase, firstVowel) & "ay" /> 
    30         <!--- We started with a vowel ---> 
    31         <cfelseif len(result)> 
    32                 <cfset result = result & "ay" /> 
    33         </cfif> 
     26    <!--- We started with a consonant ---> 
     27    <cfif len(result) and firstVowel gt 0> 
     28        <cfset result = right(arguments.phrase, len(arguments.phrase) - firstVowel) 
     29            & left(arguments.phrase, firstVowel) & "ay" /> 
     30    <!--- We started with a vowel ---> 
     31    <cfelseif len(result)> 
     32        <cfset result = result & "ay" /> 
     33    </cfif> 
    3434 
    35         <cfreturn result /> 
     35    <cfreturn result /> 
    3636</cffunction> 
    3737