473,503 Members | 12,103 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

abbreviate a string

3 New Member
hey i was asking, y'know, how do i abbreviate a string.

eg--if i give>> world health organization it'll give me<< w.h.o.
Sep 9 '07 #1
2 1707
JosAH
11,448 Recognized Expert MVP
hey i was asking, y'know, how do i abbreviate a string.

eg--if i give>> world health organization it'll give me<< w.h.o.
Think of a FSA (Finite State Machine). Your FSA needs three states:

1) NIW: 'not in word'
2) IW: 'in word'
3) EOT: 'end of text'

Your FSA is in one of the three states always. Suppose a line of text contains
letters and spaces. At the end of the text the FSA reaches state EOT. At the
start of the text the FSA is in the NIW state.

The followong state transitions induce the following actions:

NIW --> NIW: do nothing
NIW --> IW: print the current character.
NIW --> EOT: do nothing
IW --> NIW: print a dot
IW --> IW: do nothing
IW -->EOT: print a dot
EOT --> NIW: impossible state
EOT --> IW: impossible state
EOT --> EOT: do nothing

The state transitions are computed according to the current character read.

kind regards,

Jos
Sep 9 '07 #2
voidmaingetch
3 New Member
thanks jos, but im sorry i forgot to mention that its for turbo c++. anyway, thanks for your reply.
VMG
Sep 9 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

16
6704
by: Krakatioison | last post by:
My sites navigation is like this: http://www.newsbackup.com/index.php?n=000000000040900000 , depending on the variable "n" (which is always a number), it will take me anywhere on the site......
5
31156
by: Stu Cazzo | last post by:
I have the following: String myStringArray; String myString = "98 99 100"; I want to split up myString and put it into myStringArray. If I use this: myStringArray = myString.split(" "); it...
9
7987
by: John F Dutcher | last post by:
I use code like the following to retrieve fields from a form: recd = recd.append(string.ljust(form.getfirst("lname",' '),15)) recd.append(string.ljust(form.getfirst("fname",' '),15)) etc.,...
9
3668
by: Derek Hart | last post by:
I wish to execute code from a string. The string will have a function name, which will return a string: Dim a as string a = "MyFunctionName(param1, param2)" I have seen a ton of people...
10
8147
by: Angus Leeming | last post by:
Hello, Could someone explain to me why the Standard conveners chose to typedef std::string rather than derive it from std::basic_string<char, ...>? The result of course is that it is...
37
4652
by: Kevin C | last post by:
Quick Question: StringBuilder is obviously more efficient dealing with string concatenations than the old '+=' method... however, in dealing with relatively large string concatenations (ie,...
2
3174
by: maurir | last post by:
Hello I have an array of char, like these examples: John Smith Juan de la Rosa Darren Russel Miller Ana Maria da Silva Santos The output of the compacted string's image:
10
3541
by: Chris H | last post by:
Greetings, I'm trying to update an address field with "standard" abbreviations so that I can do a comparison of various accounts to one another on the address. I can update a set of records for...
7
3087
by: Sunny | last post by:
Hi, Is there a way in Javascript to abbreviate currency. Like if it is $1000 then it convert it into 1K.
0
7212
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7296
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4696
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3186
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1524
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
405
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.