C#.NET TrimStart()用法 [英] C# .NET TrimStart() usage

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

问题描述

你好,

我是一个真正的新手,谈到.NET而且我遇到了一些麻烦。我正在寻找从会话状态获取的服务器变量中修剪起始字符。我正在使用Auth_User填充会话状态。我正在寻找修剪域/来自域/用户并在我使用<%Session = [" User"]%>时返回用户名。这甚至可能还是我在风中撒尿?在此先感谢!

Hello,
I''m a real rookie when it comes to .NET and I''m having some trouble. I''m looking to trim the beginning characters from a server variable that I''m getting from session state. I''m populating the session state with "Auth_User" and am looking to trim "domain/" from "domain/user" and return just the user name when I use <%Session=["User"]%>. Is this even possible or am I peeing in the wind? Thanks in advance!

推荐答案

如果它是一个字符串,你可以尝试搜索/字符和获取字符位置(mystring.IndexOf(" /")),然后执行它的子字符串。


例如:
If it''s a string, you could try doing a search for the "/" character and getting the character position ( mystring.IndexOf("/") ) and then doing a substring of it.

So for example:
展开 | 选择 | Wrap | 行号



如果它是一个字符串,你可以尝试搜索/ ;字符和获取字符位置(mystring.IndexOf(" /")),然后执行它的子字符串。


例如:
If it''s a string, you could try doing a search for the "/" character and getting the character position ( mystring.IndexOf("/") ) and then doing a substring of it.

So for example:
展开 | 选择 | Wrap | 行号


我认为这将有效
I think this will work
< span class =codeLinkonclick =Blur(this,this.parentNode.parentNode,getChildren(this),true);>展开 | 选择 | Wrap | 行号


这篇关于C#.NET TrimStart()用法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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