Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
22
Task/Substring/ColdFusion/substring-1.cfm
Normal file
22
Task/Substring/ColdFusion/substring-1.cfm
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<cfoutput>
|
||||
<cfset str = "abcdefg">
|
||||
<cfset n = 2>
|
||||
<cfset m = 3>
|
||||
|
||||
<!--- Note: In CF index starts at 1 rather than 0
|
||||
starting from n characters in and of m length --->
|
||||
#mid( str, n, m )#
|
||||
<!--- starting from n characters in, up to the end of the string --->
|
||||
<cfset countFromRight = Len( str ) - n + 1>
|
||||
#right( str, countFromRight )#
|
||||
<!--- whole string minus last character --->
|
||||
<cfset allButLast = Len( str ) - 1>
|
||||
#left( str, allButLast )#
|
||||
<!--- starting from a known character within the string and of m length --->
|
||||
<cfset startingIndex = find( "b", str )>
|
||||
#mid( str, startingIndex, m )#
|
||||
<!--- starting from a known substring within the string and of m length --->
|
||||
<cfset startingIndexSubString = find( "bc", str )>
|
||||
#mid( str, startingIndexSubString, m )#
|
||||
|
||||
</cfoutput>
|
||||
21
Task/Substring/ColdFusion/substring-2.cfm
Normal file
21
Task/Substring/ColdFusion/substring-2.cfm
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<cfscript>
|
||||
str="abcdefg";
|
||||
n = 2;
|
||||
m = 3;
|
||||
|
||||
// Note: In CF index starts at 1 rather than 0
|
||||
// starting from n characters in and of m length
|
||||
writeOutput( mid( str, n, m ) );
|
||||
// starting from n characters in, up to the end of the string
|
||||
countFromRight = Len( str ) - n + 1;
|
||||
writeOutput( right( str, countFromRight ) );
|
||||
// whole string minus last character
|
||||
allButLast = Len( str ) - 1;
|
||||
writeOutput( left( str, allButLast ) );
|
||||
// starting from a known character within the string and of m length
|
||||
startingIndex = find( "b", str );
|
||||
writeOutput( mid( str, startingIndex, m ) );
|
||||
// starting from a known substring within the string and of m length
|
||||
startingIndexSubString = find( "bc", str );
|
||||
writeOutput( mid( str, startingIndexSubString, m ) );
|
||||
</cfscript>
|
||||
Loading…
Add table
Add a link
Reference in a new issue