comparison core/src/luan/modules/StringLuan.java @ 443:bf5e62a9090c

remove toBoolean() and to_boolean()
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 04 May 2015 14:55:51 -0600
parents 93e6e67768d7
children 8b2db645b9b2
comparison
equal deleted inserted replaced
442:75ccb4da803f 443:bf5e62a9090c
179 int i = 0; 179 int i = 0;
180 StringBuffer sb = new StringBuffer(); 180 StringBuffer sb = new StringBuffer();
181 while( i<max && m.find() ) { 181 while( i<max && m.find() ) {
182 String match = m.groupCount()==0 ? m.group() : m.group(1); 182 String match = m.groupCount()==0 ? m.group() : m.group(1);
183 Object val = t.get(luan,match); 183 Object val = t.get(luan,match);
184 if( Luan.toBoolean(val) ) { 184 if( val != null ) {
185 String replacement = luan.checkString(val); 185 String replacement = luan.checkString(val);
186 if( replacement==null ) 186 if( replacement==null )
187 throw luan.exception( "invalid replacement value (a "+Luan.type(val)+")" ); 187 throw luan.exception( "invalid replacement value (a "+Luan.type(val)+")" );
188 m.appendReplacement(sb,replacement); 188 m.appendReplacement(sb,replacement);
189 } 189 }
206 for( int j=0; j<count; j++ ) { 206 for( int j=0; j<count; j++ ) {
207 args[j] = m.group(j); 207 args[j] = m.group(j);
208 } 208 }
209 } 209 }
210 Object val = Luan.first( luan.call(fn,"repl-arg",args) ); 210 Object val = Luan.first( luan.call(fn,"repl-arg",args) );
211 if( Luan.toBoolean(val) ) { 211 if( val != null ) {
212 String replacement = luan.checkString(val); 212 String replacement = luan.checkString(val);
213 if( replacement==null ) 213 if( replacement==null )
214 throw luan.exception( "invalid replacement value (a "+Luan.type(val)+")" ); 214 throw luan.exception( "invalid replacement value (a "+Luan.type(val)+")" );
215 m.appendReplacement(sb,replacement); 215 m.appendReplacement(sb,replacement);
216 } 216 }