string - OOP 中的字符串使用 | 重复不应该重复的字母
问题描述
我正在尝试 OOP JavaScript,我的问题是下一个:
String message = Keyboard.StringReader("Introduce the message to codificate: ");
String key = Keyboard.StringReader("Introduce the key code: ");
Encryptation sequence_1 = new Encryptation(message,key);
当我放入带空格的字符串时,没有问题。它执行下面的代码:
//This is the constructor, who takes the space
public Encryptation(String p, String o){
this.message = p;
this.keycode = o;
}
//这是问题所在:当我漫游字符串并且它发生在空格所在的位置时,程序将其更改为空格之前的字母。如果this.message为“AAA AAA”,则messageToken()返回“AAAAAAA”。所以我不知道如何解决这个问题。有什么帮助吗?
public char messageToken(){
int i = 0
i++;
return this.message.charAt(i);
}
解决方案
看起来您的 messagetoken 总是返回 charAt(1)
推荐阅读
- javascript - React TypeError:无法读取未定义的属性“替换”
- python - Python3 一个字符串到变量
- c++ - OpenGL 在 VMWare Fusion 版本 10.1.3 上设置的虚拟机 (Ubuntu 16.04) 上崩溃。
- javascript - 使用 redux saga 时出错,take(patternOrChannel): argument 8 is not valid channel or a valid pattern
- wordpress - Wordpress 表键关系
- swift - 如何在 Swift 中使用 String(contentsOfFile: )?
- python - 我可以使用 python 抓取本地托管的网站吗?
- python - 连接 np.arrays python
- php - $_REQUEST["url"] 没有得到完整的 url
- google-bigquery - 具有外部依赖项的 Moqui 脚本