将字符串转换为二维char数组 [英] Convert string into two dimensional char array

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

问题描述

大家好,



我遇到了一个问题。是否有可能将一组字符串值转换为二维字符数组。我有一个2D char数组,如下所示,



public char [,] in_names;



in_names = new char [10,20];



现在我想把一些字符串值放到这个数组中。但是我很难找到语法(如何兑换)。任何人请指导。



湿婆..

Hi everyone,

I have struck with one problem.Is it possible to convert a set of string values into two dimensional char array. I have a 2D char array like as follows,

public char[,] in_names;

in_names = new char[10,20];

Now i want to put some set of string values into this array.But i am struggling to find the syntax (how to convert). Any one pls guide on this.

Shiva..

推荐答案

Hi Shiva

你可以做以下

1-declar花药字符数组

2 - 将你的字符串复制到字符数组

3-复制结果char数组到你的目标char

4- more likley你需要这个

YourString.CopyTo(0,UrSecondChararray,0,len);

i希望这能解决你的问题

khalid sabtan

saudia arabia
Hi Shiva
you could do the following
1-declar anther char array
2-Copy your string to that char array
3- Copy the result char array to ur target char
4- more likley u need this
YourString.CopyTo(0, UrSecondChararray, 0, len);
i hope this solve ur problem
khalid sabtan
saudia arabia


你必须编写自己的函数才能做到这一点,使用循环来解决这个问题。
You have to write your own function to do this, and use looping to solve this issue.


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

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