如何查找字符串的最后一个字符 [英] How to find last character of a string

查看:105
本文介绍了如何查找字符串的最后一个字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,





我的问题是如何找到一个单词的最后一个字符Example_10或任何单词......

hello,


my question is that how to find last character of a word Example_10 or any word...

推荐答案

使用以下代码:

Use the following codes:
string sAllCharacter="abcdef....yz";
char cLastCharacter=sAllCharacter[sAllCharacter.Lenght-1];

output=z;


简单方法



Simple way

str = str.Substring(str.Length - 1);


参考这些:



http://www.dotnetperls.com/string-char [ ^ ]



http://bytes.com/topic/c-sharp/answers/735358-get-last -two-characters-string [ ^ ]
Refer these:

http://www.dotnetperls.com/string-char[^]

http://bytes.com/topic/c-sharp/answers/735358-get-last-two-characters-string[^]


这篇关于如何查找字符串的最后一个字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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