How to prevent lines containing the word yes or no from being printed as true or false?

I am currently setting several variables:

<cfset printPage = "YES">

In the end, when I print these variables, everything I try to set to "YES" is printed as "true." Everything that is set to NO is displayed as false. I do not mind using the function YesNoFormat. In fact, I could use this feature in this application, but at the same time I would like to know if ColdFusion really stores the words “YES” and “NO” in memory or converts them to a logical format backstage.

If CF stores my variables exactly as I declare them, how would I like to get these variables as strings? If CF somehow modifies the variables, are there any special characters or keywords that I could use to make it store the variables as strings?

Thanks to everyone who commented / replied. I experimented and read a bit, and it seems that the serializeJSON function automatically converts Yes to True and No to false. I either need to solve this problem in my javascript, or I can add a space in the affected properties to get around this behavior.

+4
source share
1 answer

, "" "" ( YesNoFormat()). , ColdFusion . . , Java, JavaCast(). , - . , , , . JavaCast.

ColdFusion. , , , .

ColdFusion , , ColdFusion . , , , , ColdFusion . ColdFusion , . , , , .

ColdFusion :

. ColdFusion. , , .

, GIF .

. . ColdFusion , , XML-. , ​​ , ColdFusion, . , , myArray, myArray * 5. myArray [3] * 5, .

. , .

:


ColdFusion , " " , .

ColdFusion :

  • IsArray
  • IsBinary
  • IsBoolean
  • IsImage
  • IsNumericDate
  • IsObject
  • IsPDFObject
  • IsQuery
  • IsSimpleValue
  • IsStruct
  • IsXmlDoc

ColdFusion , ​​ :

  • IsDate
  • IsNumeric
  • IsXML

, - IsBoolean(printPage), , . , , , ColdFusion .

-1

Source: https://habr.com/ru/post/1661077/


All Articles