| VAL | |
| 説明
文字列の先頭にある数字を数値に変換します。 |
|
| 戻り値
数値。変換に失敗した場合は 0 が返されます。 |
|
| カテゴリ
変換関数、文字列関数 |
|
関数のシンタックスVal(string) |
|
| 関連項目
IsNumeric |
|
| パラメータ
|
|
| 使用方法
この関数は、次のように処理を行います。
|
|
例<h3>Val の例</h3>
<cfif IsDefined("FORM.theTestValue")>
<cfif Val(FORM.theTestValue) is not 0>
<h3>文字列 <cfoutput>#DE(FORM.theTestValue)#</cfoutput>
は次の数値に変換できます。
<cfoutput>#Val(FORM.theTestValue)#</cfoutput></h3>
<cfelse>
<h3>文字列 <cfoutput>#DE(FORM.theTestValue)#
</cfoutput> の先頭は、数値に変換できません。</h3>
</cfif>
</cfif>
<form action = "val.cfm">
<p>文字列を入力し、数値として評価できるかどうかを調べます。
<p>
<input type = "Text"
name = "TheTestValue"
value = "123Boy">
<input type = "Submit"
value = "数字で始まりますか?"
name = "">
</form>
|
|
| STRING | |
| 文字列、または文字列を含んでいる変数です。 | |