001    /**
002     * Implements the CFML Function stripcr
003     */
004    package railo.runtime.functions.other;
005    
006    import railo.runtime.PageContext;
007    import railo.runtime.ext.function.Function;
008    
009    public final class StripCr implements Function {
010    
011            public static String call(PageContext pc , String string) {
012                    StringBuffer sb=new StringBuffer(string.length());
013                    int start=0;
014                    int pos=0;
015                    
016                    while((pos=string.indexOf('\r',start))!=-1) {
017                            sb.append(string.substring(start,pos));
018                            start=pos+1;
019                    }
020                    if(start<string.length())sb.append(string.substring(start,string.length()));
021                    
022                    return sb.toString();
023            }       
024    }