Mercurial Hosting > luan
comparison core/src/luan/modules/StringLuan.java @ 586:a140be489a72
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 24 Aug 2015 02:17:46 -0600 |
parents | 60c549d43988 |
children | 35dde32c02ab |
comparison
equal
deleted
inserted
replaced
585:bb3818249dfb | 586:a140be489a72 |
---|---|
146 } | 146 } |
147 }; | 147 }; |
148 } | 148 } |
149 | 149 |
150 @LuanMethod public static Object[] gsub(LuanState luan,String s,String pattern,Object repl,Integer n) throws LuanException { | 150 @LuanMethod public static Object[] gsub(LuanState luan,String s,String pattern,Object repl,Integer n) throws LuanException { |
151 Utils.checkNotNull(luan,s); | |
151 int max = n==null ? Integer.MAX_VALUE : n; | 152 int max = n==null ? Integer.MAX_VALUE : n; |
152 final Matcher m = Pattern.compile(pattern).matcher(s); | 153 final Matcher m = Pattern.compile(pattern).matcher(s); |
153 if( repl instanceof String ) { | 154 if( repl instanceof String ) { |
154 String replacement = (String)repl; | 155 String replacement = (String)repl; |
155 int i = 0; | 156 int i = 0; |