在行中分割字符串 [英] Split string in line
本文介绍了在行中分割字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想根据位置编号分割字符串.
例如:
我有一个类似这很好"的字符串
然后我想要从第二个位置到第五个位置的字符串
任何人都可以帮忙.
谢谢,
Prasant
Hi,
I want to split a string based on position number.
for ex:
i have a string like "this is good"
Then i want the string from 2nd position to 5th position
Could anyone help on this.
Thanks,
Prasant
推荐答案
我认为您的意思是说您想要字符串的一部分(或通常称为子字符串").
I think you mean to say you want the portion of the string (or what is commonly called a "substring").
string x = "this is good";
string y = x.Substring(1,4);
变量y
应包含"his".
The variable y
should contain "his ".
网络上有成千上万的链接.
简单的Google搜索可以解决您的问题.
在此处发布问题之前,请先在Google/CP中尝试.
Google是您的朋友.:rose :: rose:
There are thousands of links available on the Net.,
Simple Google Search is solve your Problem.
Try in Google / CP Before Posting Question Here.
Google is your Friend.:rose::rose:
使用子字符串功能
Use substring function
string str="this is good";
string s0 = str.Substring(1, 4);
看看了解更多
这篇关于在行中分割字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文