Knowledge Base - Technical Articles
HowTo: Convert a string to proper case in the ArcMap Field Calculator
| Article ID: | 31541 |
|---|---|
| Software: | ArcGIS - ArcEditor 8.3, 9.0, 9.1, 9.2, 9.3, 9.3.1 ArcGIS - ArcInfo 9.0, 8.3, 9.1, 9.2, 9.3, 9.3.1 ArcGIS - ArcView 8.3, 9.0, 9.1, 9.2, 9.3, 9.3.1 |
| Platforms: | Windows 2000, XP, 2003Server, Vista, 2008Server, Win 7 |
Summary
Instructions provided describe how to use the ArcMap Field Calculator to convert an upper case, lower case or mixed case string to proper case. For example, a string that is in the following formats:
"hello world"
"HELLO WORLD"
"hELLO wORLD"
The VBA function "StrConv" converts the string to: "Hello World".
For information on how to do the equivalent steps in a label expression, please see the link in the Related Information section below.
Procedure
- Add a new text field to the attribute table to store the new string values.
-show me- A. If in editing mode, stop the current editing session.
B. Open the feature's attribute table.
C. Click Options.
D. Click Add Field.
E. Name the field.
F. Type: 'Text'.
G. Set the Length property. - Open the ArcMap Field Calculator for the field created in the step above by right-clicking the new field name heading in the Table View and click Calculate Values.
- In the Field Calculator dialog box, type the following code in the text box under "Your Field Name = "
StrConv([Existing Field], vbProperCase)
Change [Existing Field] to match the name of the existing field that contains the string values that are not currently in the proper case. - Click OK in the Field Calculator dialog box.
Related Information
- Convert a string to proper case in a label expression
Instructions provided describe how to use a label expression to convert a string that is upper case, lower case or mixed case to proper case. For example, if a string that is in the following formats: "hello world" "HELLO WORLD" "hELLO wOR... - Convert a string to proper case in the ArcMap 10 Field Calculator
Created: 8/4/2006
Last Modified: 5/19/2011
Comments
By Anonymous - 12/28/2010 11:54 AM
I would like to see a new article that discusses the topic outlined below.
This needs to be updated to include instructions for version 10.
Rating:
By Anonymous - 09/22/2009 1:30 PM
I followed the article’s instructions, but experienced another problem. I’ve provided details below.
I tried this solution today, in AV 9.3.1, and got a message saying that it will not run because of a "type mismatch."
Rating:
By Anonymous - 01/08/2009 9:46 AM
I followed the article’s instructions, but experienced another problem. I’ve provided details below.
Great script, but it doesn't deal with ordinal indicators. eg. "77TH AVE" becomes "77Th Ave", not "77th Ave" "43RD RD" becomes "43Rd Rd", not "43rd Rd"
Rating:
By Anonymous - 07/29/2008 3:45 PM
I followed the article’s instructions, but experienced another problem. I’ve provided details below.
I'm using 9.3 and I get an "Error running VBA code : User Interrupt" error and then a second error "Type Mismatch: 'StrConv'". I'm using one string field to calculate another with the vbProperCase option. My data has names in the "Last, First" format. I used this function in the past with 9.2 on different data, so maybe test on 9.3 or is it the commas maybe?
Rating:
By Anonymous - 08/03/2007 8:23 AM
The article is incorrect or the solution didn’t work.
In Arcgis 9.2 I tried this. I get a VBA user interupt and type conversion error. It does not seem to see the strconv as a command. The field is most definitely a text/string field.
Rating:
By Anonymous - 03/29/2007 9:44 AM
The article needs to be updated.
This script does not seem to work for 9.2. I love having to go back to AML's
Rating:
By Anonymous - 03/08/2007 2:26 PM
Other - See details below.
Do you have to have the Developers Kit installed for this to work?? I didn't install it with my 9.2 upgrade and StrConv produced a Type Mismatch. The guy next door did install the Developers Kit and StrConv worked like a charm. I'm guessing I'm missing a .dll or something. If that is the case it might save others alot of time if it were mentioned in this article!
Rating:
By nsharp - 05/18/2011 11:17 PM
I followed the article’s instructions, but experienced another problem. I’ve provided details below.
you need the VB6 SDK installed
Rating: