C#获取字符串后几位数的方法
作者:MeGoodtoo 时间:2022-06-07 21:39:33
本文实例讲述了C#获取字符串后几位数的方法。分享给大家供大家参考。具体实现方法如下:
#region 获取后几位数 public string GetLastStr(string str,int num)
/// <summary>
/// 获取后几位数
/// </summary>
/// <param name="str">要截取的字符串</param>
/// <param name="num">返回的具体位数</param>
/// <returns>返回结果的字符串</returns>
public string GetLastStr(string str, int num)
{
int count = 0;
if (str.Length > num)
{
count = str.Length - num;
str = str.Substring(count, num);
}
return str;
}
#endregion
希望本文所述对大家的C#程序设计有所帮助。
标签:C#,获取,字符串,方法
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
C# 最基础知识介绍--多态
2022-07-10 14:34:36
![](https://img.aspxhome.com/file/2023/1/79111_0s.jpg)
java实现简单的猜数字小游戏
2023-11-11 12:55:40
![](https://img.aspxhome.com/file/2023/5/59055_0s.jpg)
SpringBoot+Jpa项目配置双数据源的实现
2022-11-01 14:05:04
![](https://img.aspxhome.com/file/2023/0/66540_0s.png)
Android登录注册功能 数据库SQLite验证
2023-10-01 20:58:55
![](https://img.aspxhome.com/file/2023/6/86926_0s.gif)
JVM 心得分享(加载 链接 初始化)
2023-09-01 19:17:50
java身份证合法性校验并提取身份证有效信息
2023-04-18 17:26:18
SpringBoot内部调用事务不起作用问题的解决方案
2023-11-17 13:38:35
Android SharedPreferences存储用法详解
2023-08-07 08:25:34
![](https://img.aspxhome.com/file/2023/8/83528_0s.gif)
C#调用JS的几种方法
2022-09-29 23:24:18
重温C# clr 笔记总结
2023-06-22 02:24:30
SpringBoot启动yaml报错的解决
2021-09-09 22:58:14
![](https://img.aspxhome.com/file/2023/9/69089_0s.png)
详细图解Java中字符串的初始化
2023-11-20 19:34:24
![](https://img.aspxhome.com/file/2023/0/78010_0s.png)
flutter实现发送验证码功能
2023-07-05 19:03:12
![](https://img.aspxhome.com/file/2023/3/90173_0s.jpg)
C#中数组初始化、反转和排序用法实例
2023-05-03 23:03:10
详解Java代码常见优化方案
2023-11-29 03:13:04
Java反射获取实例的速度对比分析
2021-06-14 09:22:29
详解SpringCloud的负载均衡
2022-03-14 03:42:28
![](https://img.aspxhome.com/file/2023/8/78348_0s.png)
详解SpringBoot的事务管理
2022-01-15 13:39:26
![](https://img.aspxhome.com/file/2023/0/74750_0s.png)
SSM Mapper文件查询出返回数据查不到个别字段的问题
2023-10-17 01:02:08
![](https://img.aspxhome.com/file/2023/3/58603_0s.png)
如何基于java实现Gauss消元法过程解析
2023-12-15 21:51:08
![](https://img.aspxhome.com/file/2023/3/66953_0s.png)