【发布时间】:2018-08-14 18:54:00
【问题描述】:
私人无效 btnTranslateActionPerformed(java.awt.event.ActionEvent evt) {
字符串 strSecretMessage;
strSecretMessage = this.txtSecretMessage.getText();
for (int i=0; i < (strSecretMessage.length()-1); i++){
lblACSII.setText(i+" "+ strSecretMessage.charCodeAt(i));
}
}
charCodeAt 出现错误,提示找不到符号。
【问题讨论】:
-
你的意思是使用
charAt()的方法吗? -
这不是一个实际的方法:
charAt? -
我正在尝试转换为 ASCII。我需要显示字母对应的ASCII字符。
-
@alexphan 正如我们所建议的,您是否尝试过使用
charAt()?charCodeAt()不是String中声明的方法。 -
我试过了,它只显示字符串的特定数字的字符。