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

Trim

Explorer ,
Mar 11, 2013 Mar 11, 2013

Copy link to clipboard

Copied

Views

425

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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)


Votes

Translate

Translate

Report

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
Documentation