我正在尝试拆分单词的每个字符..例如“CAT”=C,A,T
我已经能够获得单词的完整长度..通过在编辑文本中输入..
package com.pack.name;
import android.R.array;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class NamtestActivity extends Activity implements OnClickListener {
/** Called when the activity is first created. */
EditText name;
Button save;
String sname;
int pname, i;
char eachword[];
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
name = (EditText) findViewById(R.id.editText1);
save = (Button) findViewById(R.id.button1);
save.setOnClickListener(this);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
sname = name.getText().toString();
pname = sname.length();
Toast.makeText(getApplicationContext(), "" + pname, Toast.LENGTH_LONG)
.show();
//for (i = 0; i < pname; i++) {
}
}
}
在这里,我们从edittext中获取输入,然后通过单击按钮显示单词的长度...现在我需要拆分单词..我试图在for循环中执行此操作...请帮助.. ...