Flylib.com

Books Software

 
 
 

Inside Coldfusion MX - page 498

"-->

Right

Right (

string

,

count

)

Description

Gets a specified number of characters from a string, beginning at the right.

Example

<cfset exampleString = "(303)455-5000 ext:310"> 

<cfoutput> 
The extension number is: #Right(exampleString, 3)# 
</cfoutput>
"-->

RJustify

RJustify (

string

,

length

)

Description

Right-justifies characters in a string.

Example

<cfset exampleString = "right justified"> 

<cfoutput> 
The example string right justified: #RJustify(exampleString, 30)# 
</cfoutput>
"-->

Round

Round (

number

)

Description

Rounds a number to the closest integer following standard mathematical rules.

Example

<cfoutput> 
10.49 stays at 10: #Round(10.49)# 
10.51 goes to 11: #Round(10.51)# 
</cfoutput>

RTrim

RTrim (

string

)

Description

Deletes spaces from the end of a string.

Example

<cfset exampleString = "This string has spaces at the end.     "> 

<cfoutput> 
The trimmed string: "#Rtrim(exampleString)#" 
</cfoutput>
"-->

Second

Second (

date

)

Description

Extracts the seconds from a date/time object.

Example

<cfoutput> 
 The current second #Second(Now())# of the day. 
</cfoutput>
"-->

SetEncoding

SetEncoding (

scope_name

,

charset

)

Description

For when the locale is anything except English, this sets the character encoding of form scope variable values. Scope name can be either a URL or a form name.

Example

In this example an example form is set and we are assuming that Japanese Shift-JIS characters are being sent to the processing page.

<form action="example.cfm" method="post"> 
Name: <input type="text" name="exampleName"> 
Address: <input type="text" name="exampleAddress"> 
City: Name: <input type="text" name="exampleCity"> 
</form> 

<form name="exampleForm" action="example.cfm" method="post"> 
Name: <input type="text" name="exampleName"> 
Address: <input type="text" name="exampleAddress"> 
City: Name: <input type="text" name="exampleCity"> 
</form> 

<cfscript> 
 setEncoding("exampleForm", "SHIFT-JIS"); 
 newName = "#exampleForm.exampleName#"; 
 newAddress = "#exampleForm.exampleAddress#"; 
 newCity = "#exampleForm.exampleCity#"; 
</cfscript>
"-->

SetLocale

SetLocale (

new_locale

)

Description

Sets a country/language locale option for the current application session. The locale value encapsulates a set of attributes that determines the default display format of date, time, number, and currency values, according to language and regional conventions. Locales include the following:

Chinese (China)

 

Chinese (Hong Kong)

 

Chinese (Taiwan)

 

Dutch (Belgian)

nl_be

Dutch (Standard)

nl_NL

English (Australian)

en_AU

English (Canadian)

en_CA

English (New Zealand)

en_NZ

English (UK)

en_GB

English (US)

en_US

French (Belgian)

fr_BE

French (Canadian)

fr_CA

French (Standard)

fr_FR

French (Swiss)

fr_CH

German (Austrian)

de_AT

German (Standard)

de_DE

German (Swiss)

de_CH

Italian (Standard)

it_IT

Italian (Swiss)

it_CH

Japanese

ja_JP

Korean

ko_KR

Norwegian (Bokmal)

no_NO

Norwegian (Nynorsk)

no_NO_nynorsk

Portuguese (Brazilian)

pt_BR

Portuguese (Standard)

pt_PT

Spanish (Modern)

es_ES

Spanish (Standard)

es_ES

Swedish

sv_SE

Example

<cfset tempLocale = SetLocale("Portuguese (Standard)")> 

<cfoutput> 
The locale is now set to: #GetLocale()# 
</cfoutput>