RemoveChars

Description

Returns string with count characters removed from a specified starting position. Return 0 if no characters are found.

Category

String functions

Syntax

RemoveChars(string, start, count) 

See also

Insert, Len

Parameters

Parameter
Description
string
A string
start
Starting position for the search
count
Number of characters to remove

Example

<!--- This example shows the use of RemoveChars --->
<html>
<head>
<title>
RemoveChars Example
</title>
</head>

<body bgcolor = silver>
<H3>RemoveChars Example</H3>

Returns a string with <I>count</I> characters removed from the 
starting position. Returns 0 if no characters are found.

<cfif IsDefined("FORM.myString")>
  <cfif Evaluate(FORM.numChars + FORM.start) 
   GT Len(FORM.myString)>
    <P>Your string is only <cfoutput>#Len(FORM.myString)#
     </cfoutput> characters long.
    Please enter a longer string, select fewer characters to remove or
    begin earlier in the string.
  <cfelse>
    <cfoutput>
    <P>Your original string:   #FORM.myString#
    <P>Your modified string:  #RemoveChars(FORM.myString,
     FORM.numChars, FORM.start)#
    </cfoutput>
...