Sha256: 783bc21c6c70c08fe9463a1b49d51561ab7801ee104b9de7c8a268e95701fa22

Contents?: true

Size: 632 Bytes

Versions: 72

Compression:

Stored size: 632 Bytes

Contents

/**
* Here is an example solution for the PigLatin exercise
*/
component {

	function translate( input ) {
		var response = '';
		
		// Loop over each work
		return input
			.listToArray( ' ' )
			.map( function( word ) {
		
				// Vowel sounds 
				if( word.reFindNoCase( '^(a|e|i|o|u|yt|xr)' ) ) {
					return word & 'ay';
				// Consonate sounds
				} else if( word.reFindNoCase( '^(ch|squ|qu|thr|th|sch)' ) ) {
					return word.reReplaceNoCase( '^(ch|squ|qu|thr|th|sch)(.*)', '\2\1ay' );
				// Everything else
				} else {
					return word.right( -1 ) & word.left( 1 ) & 'ay';
				}
						
			} )
			.toList( ' ' );
		
	}
			
}

Version data entries

72 entries across 71 versions & 1 rubygems

Version Path
trackler-2.2.1.104 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.103 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.102 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.101 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.100 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.99 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.98 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.97 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.96 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.95 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.94 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.93 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.92 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.91 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.90 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.89 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.88 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.87 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.86 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.85 tracks/cfml/exercises/pig-latin/Solution.cfc