String comparison

I have a form that returns a list similar to this when submitted:

2009,9

I want to compare it with the values ​​output from the database, but keep getting the error.

<cfif #FORM.month# eq #qGetDates.year#,#qGetDates.month#>

I know that I probably have to give it away or convert it to a string for comparison in order to work, how to do it?

Thank,

R.

+3
source share
3 answers
<cfif FORM.month eq "#qGetDates.year#,#qGetDates.month#">

or

<cfif compare(FORM.month, "#qGetDates.year#,#qGetDates.month#") EQ 0>
+11
source

If you want to get the second value (the value after the first comma), then

<cfset x = "2009,7">
<cfoutput>
    #listGetAt(x,2)#
</cfoutput>
+1
source

#. cfoutput, # .

: ( ). ( #), .

<cfif #FORM.month# eq #qGetDates.year#,#qGetDates.month#>

# ,

<cfif FORM.month eq qGetDates.year & "," & qGetDates.month>

,

+1
source

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


All Articles