Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Trim

Explorer ,
Mar 11, 2013 Mar 11, 2013
478
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 11, 2013 Mar 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 11, 2013 Mar 11, 2013
LATEST

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)


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources