Solved

I need to compare 2 similar strings and choose upper case when available

Posted on 2011-03-24
3
317 Views
Last Modified: 2012-05-11
I have two instances of a name and need to merge them thusly:

Activity
activities

should create
Activities

How can I do this in C#?

newbieweb
0
Comment
Question by:newbieweb
3 Comments
 
LVL 9

Accepted Solution

by:
jerrypd earned 500 total points
ID: 35207115
you need logic to determine how "similar" the words are to determine if they are the same.
for example Activities and activate, or active...
once you have that logic, then you just need to set the first character to uppercase.
But, given the weirdness of the english language, I think the hardest part will be the "rules" for similar words...
0
 

Author Closing Comment

by:newbieweb
ID: 35207128
thanks.
0
 
LVL 7

Expert Comment

by:dimaj
ID: 35207159
I'm not sure if this will work 100% of the time, but my approach would be as follows:
1) Loop through both strings character-by-character
2) Compare current character's ascii numbers
3a) If absolute value of ascii of  str1 - ascii of str2 == 32, then pick the one with a lower number (that's your upper case)
3b) if ascii of str1 == ascii of str2, pick whichever one you like
4) If you're at the end of one of the strings, go back one and append leftovers from the other string

4th step will basically handle your substitution of 'y' for 'ies'

I hope this will get you started.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now