comparison core/src/luan/modules/StringLuan.java @ 440:93e6e67768d7

remove Luan.asString()
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 04 May 2015 11:34:38 -0600
parents 23a93c118042
children bf5e62a9090c
comparison
equal deleted inserted replaced
439:057c10f55f72 440:93e6e67768d7
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( Luan.toBoolean(val) ) {
185 String replacement = Luan.asString(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 }
190 i++; 190 i++;
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( Luan.toBoolean(val) ) {
212 String replacement = Luan.asString(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 }
217 i++; 217 i++;