获取数据表中字符串的长度 [英] get length of a string in dataTable

查看:213
本文介绍了获取数据表中字符串的长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hiii全部
我在数据表上进行了一个for循环,并从其中调用了一行,看起来像字符串"1/2/3/4/7"

我想知道那个字符串的长度??
我试图获取"/"的最后一个索引,但是我发现我想要整个字符串的长度.


所以,有什么帮助吗?

谢谢

hiii all
i make a for loop on datatable and take one row from it calling path which looks like that string "1/2/3/4/7"

i want to know the lenght of that string???
i tried to get the last index of "/" , but i found that i want the whole length of the string.


So , any help , please??

Thanks

推荐答案

使用 String.Length属性 [ ^ ].




尝试此操作以获取字符串长度

Hi,

try this to get lenght of string

string str = "1/2/3/4/7";
        int ttl = str.Length;
        string[] resstr = str.Split('/');
        int rwcnt=resstr.Length;



在上面的代码中,ttl表示字符串的长度,包括"/"
而rwcnt表示长度是指排除''/''


最好的



In the above code ttl means length of string including ''/''
and rwcnt means length means excluding ''/''


All the Best


这篇关于获取数据表中字符串的长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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