Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Proper capitalization of a name or company 1

Status
Not open for further replies.

gentforreal

Programmer
Oct 19, 2002
62
US
We deal with many files that have hypenated names such as King Oldsmobile-honda. I have seen but cant find again funtions or snippets to conver Oldsmobile-honda to Oldsmobile-Honda.

Does anyone know of a function or small program snippet I could use to convert these pesky hyphenated names?

Thanks!
Will
 
A quick and dirty way to determine if a field exists:

Code:
IF TYPE("fieldname")="U"
   ? "This field does not exist"
ENDIF

If testing in another workarea, use TYPE("alias.fieldname").
 
LOL.... Thought I wanted those pesky hyphens eh? Glad you had fun with the problem and thanks for the tips on fields.

Will
 
DbMark...

A quick and dirty way to determine if a field exists:

IF TYPE("fieldname")="U"
? "This field does not exist"
ENDIF

This works perfect. ... but what does the "U" mean other than not exist.. and what is the opposite of "U" meaning exisits? Thanks for your help.
 
TYPE() returns the type of variable, and VARTYPE() is a more limited but faster variation of it, form ore info check the docs or help menu.

The returned character describes var type (dBase,FP,VFP):
U - undefined
C - character
N - numeric (in VFP also integer, float, double)
L - logical
M - memo *
D - date
VFP additional types:
T - datetime
Y - currency
G - general
O - object
S - screen **
X - null ***
* detected as "C" by VARTYPE()
** not sure if or how detected by VARTYPE()
*** detect as "L" by TYPE()

Say for example you have two vars:

nn=22
cc="nn"

VARTYPE(nn) returns N
VARTYPE(cc) returns C

TYPE() can do the same if you add quotes:

TYPE("nn") returns N
TYPE("cc") returns C

What happens if you don't add quotes to TYPE()?

TYPE(nn) returns U (undefined!)
TYPE(cc) returns N

What happened? This is the power of TYPE()! It looks inside nn and cc to see if the CONTENTS of those variables can be evaluated in turn as variables. Think of it as boxes within boxes. The first was "U" for undefined since nn contained 55 which cannot be a variable. The second was "N" for numeric since cc contained "nn" which could be evaluated to a defined variable of type "N". Neat, huh?

This is especially valuable when generic subroutines get passed variables referencing other variables. Being able to test "referenced variables" helps detect potential errors before encountering unexpected values. Confused yet? You'll get used to it after a while.
 
Gee.. Thats a powerful function.. I never knew it existed.. In fact, I found no reference to it in my MSDN files. Thanks.. I will use this info for alot of my work.
:)
 
Umm yea,, LOL.. played with it today and like you said "confused yet?".. and got confused.. but.. like you said.. I will get used to it.. I hope. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top