Word Document Properties


Chapter 4: Storing and Modifying Information



Download 8,82 Mb.
Pdf ko'rish
bet86/207
Sana16.03.2022
Hajmi8,82 Mb.
#496217
1   ...   82   83   84   85   86   87   88   89   ...   207
Bog'liq
VBA For Dummies 5th Ed.pdf ( PDFDrive )

Chapter 4: Storing and Modifying Information
09_046500 ch04.qxp 12/5/06 5:54 PM Page 89


The program begins by creating a string that has extra spaces on both ends.
It then performs four steps to create an output string that demonstrates the
various string features. The first step determines the current string length by
using the 
Len
function. However, the 
Len
function outputs a number, so the
code uses the 
CStr
function to convert the number to a string. Notice how
the 
Len
function acts as input to the 
CStr
function. You can 
nest
functions
like this to produce special effects.
The three function strings work the same. The code first computes the
output string size and places it in the 
Output
string. It then removes
the excess spaces and places this value into the 
Output
string as well.
Notice that the code uses 
Chr(&H22)
in several places. This function and
value produce a double quote. Because VBA uses the double quote to show
the beginning and end of a string value, this is one of the few ways that you
can add a double quote to your string. In this case, the double quote shows
the beginning and end of the string so that you can better see the space
removal feature.
Getting the data you need
Strings can contain more information than you actually need or can contain 
it in a form that you can’t use. You might use a string to provide storage
for several pieces of information that you need to send to another location.
When the string arrives at its destination, the receiving program unpacks the
individual data elements from the string.
All these actions rely on some form of 
parsing,
which is the act of removing
and interpreting sub-elements from a storage element, such as a string. You
can create a single string that contains 
Hello World
and separate it into
two pieces, 
Hello
and 
World
, by using parsing. A program could store
these separate elements and use this technique for various purposes.
The three functions that you use to extract information from a string are
Left

Right
, and 
Mid
. As their names suggest, you use the first to extract
the left side of the string, the second to extract the right side, and the third
to extract the middle. These three functions require location information and
input on where to start and stop extracting information. You use the 
InStr
and 
InStrRev
functions to find this information. Listing 4-6 shows some of
the techniques that you can use to parse a string.

Download 8,82 Mb.

Do'stlaringiz bilan baham:
1   ...   82   83   84   85   86   87   88   89   ...   207




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish