运算符'-='不能应用于'string'和'char'类型的操作数 [英] Operator '-=' cannot be applied to operands of type 'string' and 'char'

查看:497
本文介绍了运算符'-='不能应用于'string'和'char'类型的操作数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

for(int i = 0; i< theString.Length; i ++)
                {
                    output_screen.Text-=(char)(((((((Convert.ToInt32(theString.ToCharArray()[i]]-97)))-(Convert.ToInt32(key_input.Text)))%26)+ 97);
                }

for (int i = 0; i < theString.Length; i++)
                {
                    output_screen.Text -= (char)(((((Convert.ToInt32(theString.ToCharArray()[i])-97)) - (Convert.ToInt32(key_input.Text))) % 26) + 97);
                }

错误是:

错误 1 运算符'-='不能应用于类型为'string'和'char'的操作数

Error 1 Operator '-=' cannot be applied to operands of type 'string' and 'char'

h 现在我解决了吗?

推荐答案

它是错误显然意味着什么,但是您要达到什么目的?

It's obvious what the error means, but what are you trying to achieve?

您想发生什么?您要从字符串中删除所有出现的字符,还是仅删除最后一个字符,还是什么?

What do you want to happen? Do you want to remove all occurrences of the character from the string, or just the last one, or what?


这篇关于运算符'-='不能应用于'string'和'char'类型的操作数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆