[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Abbreviations

Posted on 2002-04-09
8
Medium Priority
?
406 Views
Last Modified: 2010-05-02
Hi I have run into a situation where I need to make sure that a string variable I have contains less then 30 characters.  In this string variable is names of Mutual Fund companies.  If the name is longer then 30 then I need to be able to abbreviate the name.  I have some Replace() functions for the common words like "Financial", etc.  However looking at some legacy code written in VB3 I see a function Abbrev(), is this still supported and if so what does it do, and or is there a comparable function in VB6?  Thanks in advance for any help or comments.
0
Comment
Question by:Glowman
8 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6929016
To my knowledge, no such function has ever existed natively in Visual Basic (even prior to VB3)

Anthony
0
 
LVL 1

Expert Comment

by:justinhemphill
ID: 6929030
myAbbrev = Left(strLongString,30)
0
 
LVL 4

Author Comment

by:Glowman
ID: 6929046
That would be an easy way to do it justinhemphill but unfortunately I need to maintain the name not just cut it off.  thanks though
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 22

Expert Comment

by:rspahitz
ID: 6929109
If you have the VB3 source code, you'll probably find an Abbrev function somewhere in the code.  This should translate quite well into VB6.  If not, post it here and we'll help you.
0
 
LVL 4

Author Comment

by:Glowman
ID: 6929182
I am sorry Abbrev() is not a global function but rather a multidimensional array that I didn't notice before.  Anyway does anyone have an logic to determine which characters to remove from a word to abbreviate it?  I would like to avoid hundreds of Replace() functions.
0
 
LVL 22

Accepted Solution

by:
rspahitz earned 200 total points
ID: 6929226
Typically, abbreviation rules are as follows:

* Remove all vowels except for any leading vowel
* Replace "ght" with "t"
* Truncate words after 1/2 of the number of syllables.
* Optionally add a period at the end of the modified word to indicate that it is an abbreviation

Ex.
"Quality" becomes "Qlty."
"Light" becomes "lt."
"Truncate" becomes "Trunc."

Obviously, abbreviated words can be misinterpreted since they can mean different things, such as "Thought" becoming "tht" which might be misinterpreted at "that".  

For these, you may want to build a database of common abbreviations which do not follow the above rules.

Add the entries to the DB, then have your abbrev routine first check the DB.  If the word exists, use the corresponding DB entry, otherwise continue with the above rules (and any more you deem appropriate.)

0
 
LVL 4

Author Comment

by:Glowman
ID: 6931750
Thanks that was what I was looking for.  I am going to use the split function to seperate my words, do you think this is a good way to go about this?
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6931833
I'm glad that works for you.  It obviously needs some refinements, but it sounds like you're well on your way.

>split

I'd say that's a very good way to start, but remember that if you split by "space" you'll get some words with punctuation that you need to figure out how to handle.  For example, commas ("example,"), periods ("handle."), question marks, and apostrophes ("you'll") each may need to be addressed separately, as well as "words" with numbers in them.

Your best bet is to do as you're thinking (split up the words) and see what results you get, then refine the algorithm to handle the exception cases.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month19 days, 15 hours left to enroll

873 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