在 mips 中组合字符
我想知道是否有办法将两个字符组合成一个字符。 例如,我有字符 6 和 7 ,我想将它们组合起来并将结果 67 保存在寄存器中,这个问题有什么解决方案吗?
//提前谢谢
i was wondering if there was anyway of combining two characters to form one character.
For instance, i have the character 6 and 7 , i want to combine them and make the result 67 that is saved in a register, is there any solution to this problem ?
//Thx in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的意思是你想存储一串数字字符的数值?
如果是这样,您可以获取每个字符的 ASCII 值(执行必要的检查以确保它在适当的范围内),从中减去“0”的值,然后乘以 10 的位置次方(以相反的顺序编号) ,从 0 开始),然后将其添加到总值中。
例如:
Do you mean you want to store the numerical value of a string of digit characters?
If so, you can take each character's ASCII value (perform the necessary checking to make sure it's in the appropriate range), subtract the value of '0' from it, multiply it by 10 to the power of its position (numbered in reverse order, starting from 0) and then add it to a total value.
For example: