comparison 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
comparison
equal deleted inserted replaced
301:a6bf8ff720f8 302:2f8938fc518c
49 49
50 static int end(String s,Integer i,int dflt) { 50 static int end(String s,Integer i,int dflt) {
51 return i==null ? dflt : end(s,i); 51 return i==null ? dflt : end(s,i);
52 } 52 }
53 53
54 public static byte[] to_binary(String s) { 54 @LuanMethod public static Integer[] byte_(String s,Integer i,Integer j) {
55 return s.getBytes(); 55 if( i== null )
56 } 56 i = 1;
57 57 if( j==null )
58 public static int[] byte_(String s) { 58 j = i;
59 s = s.substring(i-1,j);
59 char[] a = s.toCharArray(); 60 char[] a = s.toCharArray();
60 int[] chars = new int[a.length]; 61 Integer[] chars = new Integer[a.length];
61 for( int i=0; i<a.length; i++ ) { 62 for( int k=0; k<a.length; k++ ) {
62 chars[i] = a[i]; 63 chars[k] = (int)a[k];
63 } 64 }
64 return chars; 65 return chars;
65 } 66 }
66 67
67 public static String char_(int... chars) { 68 public static String char_(int... chars) {