CFLib.org – Common Function Library Project

CharAt(str, pos)

Last updated August 27, 2001
Download UDF

author

Raymond Camden                                    Raymond Camden

Version: 1 | Requires: ColdFusion 5 | Library: StrLib

 
Rated 1 time(s). Average Rating: 3.0

Description:
Returns the character at a certain position in a string.

Return Values:
Returns a character.

Example:

<CFSET STR = "This is the end.">
<CFOUTPUT>
2nd char: #CharAt(Str,2)#<BR>
4th char: #CharAt(Str,4)#<BR>
6th char: #CharAt(Str,6)#<BR>
8th char: #CharAt(Str,8)#<BR>
</CFOUTPUT>

Parameters:

Name Description Required
str String to be checked. Yes
pos Position to get character from. Yes

Full UDF Source:

<cfscript>
/**
* Returns the character at a certain position in a string.
*
* @param str      String to be checked.
* @param pos      Position to get character from.
* @return Returns a character.
* @author Raymond Camden (ray@camdenfamily.com)
* @version 1, December 3, 2001
*/

function CharAt(str,pos) {
return Mid(str,pos,1);
}
</cfscript>

Search CFLib.org


Latest Additions

Shawn Porter Shawn Porter added
DeMoronize
3 hour(s) ago

Chris Carey Chris Carey added
readPropertiesFi...
1 day(s) ago

Randy Johnson Randy Johnson added
lastDayofWeek
3 day(s) ago

Frank Marion Frank Marion added
sitemapPing
7 day(s) ago

Top Rated

James Sleeman                                     QuickSort
Rated 5.0, 3 time(s)

Barney Boisvert indentXml
Rated 5.0, 3 time(s)

Nathan Dintenfass                                 queryColumnsToSt...
Rated 5.0, 3 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 3 time(s)

Created by Raymond Camden / Design by Justin Johnson