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  |  

Vote for DotNetNuke as your choice for winner of this year's PackT Open Source CMS Award
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
WebHostForAsp.net
 


  Sponsors  

Meet Our Sponsors

WebSecureStores -- ASP.NET & DotNetNuke Hosting Solutions
FCKeditor Project
Salaro -- Skins and more
OnyakTech
The best choice for your web site host, email hosting, and domain registration.
CrystalTech Web Hosting™
 


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
33 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
User is offline Mike Horton
2960 posts
dnn.gmss.org
5th 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
153 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
514 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.

 


Gearworx Web Hosting
As a premier provider of Web Hosting, Private/White Label hosting, Server Colocation, Dedicated Server, and other Managed Services, Gearworx offers an array of services designed to more effectively manage strategies driving businesses on the Web. Headquartered in Fremont, California our state of the art tier one data centers and distributed managed services environment enables Gearworx to offer your business enterprise level solutions through simplified processes.
Gearworx Web Hosting
Glanton: Enterprise Intranet Specialists Using DNN
Glanton Solutions are a premier provider of sevices for large corporates lloking to outsource Intranet sites.
www.glanton.com
Jetkey Smart Map
Smart Map is an AJAX powered Google Map module that displays driving directions, proximity search results and data from your own databases. Smart Map reads GPX (GPS data) files, GeoRSS feeds, and KML data. You can pass any querystring parameter to Smart Map and into your own custom queries to control what data displays on the map.
smartmap.jetkey.com

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