Hint: Look at StringBuilder :)

2010/7/5 Yan CRL Li <liyan...@cn.ibm.com>

>
> Hello,
>
> I have a Rail[Byte] named buffer, I want to convert it into a string.
> //convert buf to text;
>
> val buf: Rail[Byte]! = Rail.make[Byte](len as Int); //Here I have to make
> it as Rail[Byte] instead of string
> .... read content to buf, each is a char.
>
> var text :String  = "";
> for (var i : Int = 0; i < len; i++)
>    text += (buf(i) as Char);
>
> This is too slow. I bet there must be a clever method to do this.
> Can anyone give me some hint?
>
> Thanks in advance.
>
> Li Yan (李严)
>
> System Group, IBM China Research Lab
> Tel: 8610-58748060
> Tieline: 11905-8060
> Add: Building 19 Zhongguancun Software Park, 8 Dongbeiwang WestRoad,
> Haidian District, Beijing, 100094, P.R.China
> E-mail: liyan...@cn.ibm.com
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> X10-users mailing list
> X10-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/x10-users
>
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to