使用C#逻辑的子串 [英] Substring using C# logic

查看:69
本文介绍了使用C#逻辑的子串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个字符串是ABCD1234,如果我使用substring来剪切字符串如下:



Hi, I have a string which is "ABCD1234", if I use substring to cut the string as below:

string strOld = "ABCD1234"
string strNew = strOld.Substring(4, 7);





输出是否为1234即使我在值4后不再重视?

我无法在我的电脑上调试它,因为我的电脑已经去了维修店。任何帮助将不胜感激。



Would the output be "1234" even I do not value anymore after the value "4"?
I can't debug it at my PC as my PC has gone for repair shop. Any help would be appreciated.

推荐答案

不。我尝试在这里运行代码 http://www.tutorialspoint.com/compile_csharp_online.php [ ^ ]



我'已将数字7更改为4以输出1234.



Nope. I tried running the code through here http://www.tutorialspoint.com/compile_csharp_online.php[^]

I've changed the number 7 to 4 to output 1234.

using System.IO;
using System;

class Program
{
    static void Main()
    {
        string strOld = "ABCD1234";
        string strNew = strOld.Substring(4, 4);
        Console.WriteLine(strNew);
    }
}


这篇关于使用C#逻辑的子串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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