在C#问题中替换funstion [英] Replace funstion in C# Question
问题描述
我正在尝试在C#中使用替换功能,但似乎我不能使用
它!!!!!!!
我可以使用它在VB.NET下面
strLogonUsr = Replace(User.Identity.Name," JOHNS\","")
有谁知道我怎么样可以在C#中做到这一点吗?
Thx
***通过Developersdex发送 http://www.developersdex.com ***
不要只是参加USENET ......获得奖励!< br>
I''m trying to use Replace function in C# but it seems i can''t use
it!!!!!!!
I can use it in VB.NET below
strLogonUsr = Replace(User.Identity.Name,"JOHNS\","")
Does anybody knows how i can do this in C#?
Thx
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!
推荐答案
" Patrick Olurotimi Ige" < ig*@iprimus.com.au>在消息中写道
新闻:%2 **************** @ TK2MSFTNGP10.phx.gbl ...
"Patrick Olurotimi Ige" <ig*@iprimus.com.au> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
我正在尝试在C#中使用替换功能,但似乎我不能使用
它!!!!!!!
我可以在VB.NET下面使用它
strLogonUsr = Replace(User.Identity.Name," JOHNS \","")
有人知道我怎么能在C#中做到这一点吗?
I''m trying to use Replace function in C# but it seems i can''t use
it!!!!!!!
I can use it in VB.NET below
strLogonUsr = Replace(User.Identity.Name,"JOHNS\","")
Does anybody knows how i can do this in C#?
>
strLogonUsr = strLogonUsr.Replace(User.Identity.Name," JOHNS \\","")
strLogonUsr = strLogonUsr.Replace(User.Identity.Name,"JOHNS\\"," ")
我相信这个代码应该可以解决问题:
strLogonUsr = User.Identity.Name.Replace(" JOHNS\\,"");
-
我希望这会有所帮助,
Steve C. Orr,MCSD,MVP
http://SteveOrr.net
Patrick Olurotimi Ige < ig*@iprimus.com.au>在消息中写道
新闻:%2 **************** @ TK2MSFTNGP10.phx.gbl ...
I believe this code should do the trick:
strLogonUsr = User.Identity.Name.Replace("JOHNS\\","");
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Patrick Olurotimi Ige" <ig*@iprimus.com.au> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
我'我试图在C#中使用替换功能,但似乎我不能使用
它!!!!!!!
我可以在VB.NET下面使用它
strLogonUsr =替换(User.Identity.Name," JOHNS\","")
有谁知道我怎么能在C#中做到这一点?
Thx
** *通过开发人员指南 http://www.developersdex.com 发送***
不要只是参加USENET ......获得奖励!
I''m trying to use Replace function in C# but it seems i can''t use
it!!!!!!!
I can use it in VB.NET below
strLogonUsr = Replace(User.Identity.Name,"JOHNS\","")
Does anybody knows how i can do this in C#?
Thx
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!
Mark Rae,
thx回复!
我使用了你提供的代码,但它给了我一个错误!
我不认为C#有替换功能!
Any想法怎么做?
***通过Developersdex发送 http://www.developersdex.com ***
不要只是参加USENET ......获得奖励!
Mark Rae,
thx for the reply!
I used the code u provided but it gives me an error!
I don''t think C# has Replace function!
Any idea how to do this?
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!
这篇关于在C#问题中替换funstion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!