Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

Maximum ASP
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
WebHostForAsp.net
 


  Sponsors  

Meet Our Sponsors

MaximumASP
SourceGear - Tools for Developers
.: CounterSoft :.
telerik
ExactTarget email software solutions
Merak Mail Server
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  Problem in string.Replace()
Previous Previous
 
Next Next
New Post 6/19/2008 9:33 PM
User is offline deepak
34 posts
10th Ranked


Problem in string.Replace() 

halo guys,

i have a code like this,

String s="Deepak is working in ACSL";

s.Replace("acsl","Prodigy");

when i execute the above code the "ACSL" in String "s" is not getting replaced with Prodigy.Only when i do like below it gets replaced.

s.Replace("ACSL","Prodigy");

Also

s.Contains("AcSl")

returns false

But how to achieve the previous one.

Kindlly help me in achieving this.

All replies are appreciated

 
New Post 6/19/2008 10:44 PM
Online now... Mike Horton
3077 posts
dnn.gmss.org
4th Ranked






Re: Problem in string.Replace() 

That because the .Replace is case sensitive. That's why the second .Replace works. Are you going to be trying to take a user's input and compare it against a string that's already there and you want to be able to search no matter what the case is?

 
New Post 6/20/2008 6:11 AM
User is offline FreeDotNetNuke
156 posts
freedotnetnuke.com
9th Ranked


Re: Problem in string.Replace() 

deepak

Please use RegularExpressions instead String. RegEx allows to replace without case sensitive. For example:

Public Dim regex As Regex = New Regex( _
      "acsi", _
    RegexOptions.IgnoreCase _
    Or RegexOptions.Multiline _
    Or RegexOptions.CultureInvariant _
    Or RegexOptions.IgnorePatternWhitespace _
    Or RegexOptions.Compiled _
    )


' This is the replacement string
Public Dim regexReplace As String = _
      "_"


'' Replace the matched text in the InputText using the replacement pattern
' Dim result As String = regex.Replace(InputText,regexReplace)

Hope it will help.

Sergey


Client always right!
Pages Administration with Drag&Drop for DotNetNuke
List Of All Modules From FreeDotNetNuke
 
New Post 6/20/2008 9:18 AM
User is offline Dwayne Baldwin
516 posts
8th Ranked




Re: Problem in string.Replace() 

The replace method is case sensitive but the replace function will work fine:

s = Replace(s, "ascl", "Prodigy" , 1, -1, CompareMethod.Text)

I hope this is of some help to you.


Dwayne J. Baldwin
 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  Problem in string.Replace()
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Active Modules, Inc.
Creators of Active Forums, the best forum module for DotNetNuke
www.activemodules.com
DNNCovered.com - Your Offshore Dotnetnuke Partner
Dnncovered.com is the only Dotnetnuke offshore outsourcing center specializes in DNN skinning and module development with lowest pricing and quality service. Our staff is dedicated to websites based on DNN and our graphic designers are creative and imaginative well enough to provide customers the complete set of skinning solutions and packages
www.dnncovered.com
PointClick.Net DNN Solutions
DotNetNuke Hosting Platform for Business and personal use.
PointClick.Net Hosted Solutions

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP