将字符串转换为字符串数组 [英] Convert string to string array

查看:167
本文介绍了将字符串转换为字符串数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个整数

int _Count = 0;

和字符串数组字符串[] strImages,但是当我想比较这两个时,它表示==不能应用于字符串类型和字符串[]的操作数。

and string array string[] strImages but when i want compare these two it is saying == cannot be applied to operand of type string and string[].

推荐答案

那么整数与任何东西有什么关系呢?你的问题没有任何意义。



当然你无法将字符串与字符串数组进行比较。编译器如何确切地知道你想要他们如何比较?



你将不得不提供更多关于你正在做什么和提供的细节相关的代码片段。
So what does the integer have to do with anything? Your question doesn't make any sense.

Of course you can't compare a string to a array of strings. How is the compiler to know exactly how you want them compared?

You're going to have to give a lot more detail about exactly what you're doing and supply the relevant code snippet.


字符串是单个字,字符串数组有多个字。即字符串列表,它可以与==符号相媲美,如果你想用数组和字符串值设置索引,

ex:str [0] == String
String is single word, and array of string have multiple word. i.e. list of string, it neve be comparable with == sign, if u want to set index with array and a string value,
ex: str[0]==String


你不能将单个字符串与字符串集合进行比较,如果你想比较,你需要确保你正在将数组与它的特定索引进行比较,比如string_array [1] == string。

这意味着数组中索引1处的字符串与字符串进行比较。
you cant compare a single string to a collection of string, if you want compare you need to make sure that you are comparing array with it's specific index, like string_array[1]==string.
That means the string at index 1 in the array is being compared with string.


这篇关于将字符串转换为字符串数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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