diff core/src/luan/modules/StringLuan.java @ 302:2f8938fc518c

fix modules Binary and Html git-svn-id: https://luan-java.googlecode.com/svn/trunk@303 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Thu, 18 Dec 2014 04:56:30 +0000
parents 899253043270
children 5e7450ac27f2
line wrap: on
line diff
--- a/core/src/luan/modules/StringLuan.java	Wed Dec 17 12:35:57 2014 +0000
+++ b/core/src/luan/modules/StringLuan.java	Thu Dec 18 04:56:30 2014 +0000
@@ -51,15 +51,16 @@
 		return i==null ? dflt : end(s,i);
 	}
 
-	public static byte[] to_binary(String s) {
-		return s.getBytes();
-	}
-
-	public static int[] byte_(String s) {
+	@LuanMethod public static Integer[] byte_(String s,Integer i,Integer j) {
+		if( i== null )
+			i = 1;
+		if( j==null )
+			j = i;
+		s = s.substring(i-1,j);
 		char[] a = s.toCharArray();
-		int[] chars = new int[a.length];
-		for( int i=0; i<a.length; i++ ) {
-			chars[i] = a[i];
+		Integer[] chars = new Integer[a.length];
+		for( int k=0; k<a.length; k++ ) {
+			chars[k] = (int)a[k];
 		}
 		return chars;
 	}