Skip to main content
This topic has been closed for replies.

1 reply

Participating Frequently
March 11, 2013

What is the definition of a control character?

I would like to see an example that uses a loop that goes through the whole ASCII character set and outputs if the result of Trim(X) is different from X.

Inspiring
March 11, 2013

What is the definition of a control character?

Ans: http://en.wikipedia.org/wiki/Control_character

AND I tested

<cffile action="read" file="#expandpath('test.txt')#" variable="test" >

<cfoutput>#len(test)#</cfoutput>                                               // gives length:14

<cfoutput>#len(trim(test))#</cfoutput>                                       // gives length:12   

my input was : (ashishtondon and 2 times enter, 1 2 3 represents line number of my editor)

1 ashishtondon

2

3

I would like to see an example that uses a loop that goes through the whole ASCII character set and outputs if the result of Trim(X) is different from X.

<cfoutput>

     <cfset get_array = ArrayNew(1)/>

     <cfloop index="i" from="0" to="127">

          <cfset with_out_trim = Chr(i) />

          <cfset with_trim = trim(Chr(i)) />

           #with_out_trim#                                                             // showing character value

                           <cfif compareNoCase(with_out_trim,with_trim) neq 0>

              <cfset arrayAppend(get_array,i)/>                                  //if with_out_trim is not equal to with_trim append index to the array  

          </cfif>

               </cfloop>

</cfoutput>

<cfdump var="#get_array#">       // I dumped array i found from 1 to 32 all ASCII chars x are not equal with trim(x)