Thread overview | |||||
---|---|---|---|---|---|
|
November 20, 2008 What's the equivalence of StringBuffer (in Java) in DWT or D? | ||||
---|---|---|---|---|
| ||||
Hello everybody!I was wondering what's the translation of StringBuffer in DWT or D,please refer to below codes in Java: //******************************************** FileDialog dlg=new FileDialog(shell,SWT.MULTI); String fn=dlg.open(); if(fn!=null) { StringBuffer buf=new StringBuffer(); String[] files=dlg.getFileName(); for(int i=0,n=files.length;i<n;i++) { buf.append(dlg.getFilterPath()); if(buf.charAt(buf.length()-1) !=File.separatorChar) { buf.append(File.separatorChar); } buf.append(files[i]); buf.append(" "); } // other operation.... } //******************************************* Can anybody help to the same implement in DWT,Thanks so much!! Sam |
November 20, 2008 Re: What's the equivalence of StringBuffer (in Java) in DWT or D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sam Hu | string buf; // create a string buf ~= "text"; // append some text char c = buf[length-1]; // get the last char |
November 20, 2008 Re: What's the equivalence of StringBuffer (in Java) in DWT or D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sam Hu | Sam Hu schrieb:
> Hello everybody!I was wondering what's the translation of StringBuffer in DWT or D,please refer to below codes in Java: //********************************************
>
> FileDialog dlg=new FileDialog(shell,SWT.MULTI);
> String fn=dlg.open();
> if(fn!=null)
> {
> StringBuffer buf=new StringBuffer();
> String[] files=dlg.getFileName();
> for(int i=0,n=files.length;i<n;i++)
> {
> buf.append(dlg.getFilterPath());
> if(buf.charAt(buf.length()-1) !=File.separatorChar)
> {
> buf.append(File.separatorChar);
> }
> buf.append(files[i]);
> buf.append(" ");
> }
> // other operation....
> }
> //*******************************************
> Can anybody help to the same implement in DWT,Thanks so much!!
> Sam
tango.text.Text has similar features, but a bit different API. I used it often for porting DWT. Unfortunately there is dwt.widgets.Text which might make symbol conflicts.
|
Copyright © 1999-2021 by the D Language Foundation