comparison core/src/luan/modules/StringLuan.java @ 251:705d14f4d8ee

start web testing git-svn-id: https://luan-java.googlecode.com/svn/trunk@252 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Sun, 19 Oct 2014 03:38:47 +0000
parents 10cc873babee
children 9e0d4452e649
comparison
equal deleted inserted replaced
250:2b6f51d7af40 251:705d14f4d8ee
27 add( module, "len", String.class ); 27 add( module, "len", String.class );
28 add( module, "lower", String.class ); 28 add( module, "lower", String.class );
29 add( module, "match", String.class, String.class, Integer.class ); 29 add( module, "match", String.class, String.class, Integer.class );
30 add( module, "rep", String.class, Integer.TYPE, String.class ); 30 add( module, "rep", String.class, Integer.TYPE, String.class );
31 add( module, "reverse", String.class ); 31 add( module, "reverse", String.class );
32 add( module, "sub", String.class, Integer.TYPE, Integer.class ); 32 add( module, "sub", LuanState.class, String.class, Integer.TYPE, Integer.class );
33 add( module, "upper", String.class ); 33 add( module, "upper", String.class );
34 } catch(NoSuchMethodException e) { 34 } catch(NoSuchMethodException e) {
35 throw new RuntimeException(e); 35 throw new RuntimeException(e);
36 } 36 }
37 return module; 37 return module;
126 buf.append(s); 126 buf.append(s);
127 } 127 }
128 return buf.toString(); 128 return buf.toString();
129 } 129 }
130 130
131 public static String sub(String s,int i,Integer j) { 131 public static String sub(LuanState luan,String s,int i,Integer j) throws LuanException {
132 Utils.checkNotNull(luan,s);
132 int start = start(s,i); 133 int start = start(s,i);
133 int end = end(s,j,s.length()); 134 int end = end(s,j,s.length());
134 return s.substring(start,end); 135 return s.substring(start,end);
135 } 136 }
136 137