操作方法

操作方法:在 ArcGIS Pro 中,将字符串字段中的小写单词转换为大写形式

Last Published: July 18, 2023

摘要

When using string functions such as capitalize or replace in the Calculate Fields tool to replace a lower case letter with an upper case in a string field, only specific letters are replaced. To convert all lower case letters in a string field to upper case, use the .upper() function instead.

In this example, all the lower case letters under the Layer field of the attribute table are converted to upper case.

An attribute table with the Layer field highlighted showing it has lower case letters.

过程

Follow the steps below to convert all the lower case letters in a string field to upper case with the Calculate Fields tool.

  1. Open the project in ArcGIS Pro.
  2. In the Contents pane, right-click the layer with the attribute table (in this example, Layer) and click Attribute Table.
  3. In the attribute table, right-click the field with the lower case letters to be converted and click Calculate Field Calculate Field icon. Ensure the Expression Type is Python3.
  4. Under the Expression section in the Calculate Field pane, select the field under the Fields list, and the select the .upper() function from the Helpers list.
Note:
Set the filter to the Text helper type to make the search for the .upper() function easier.

The expression reads as follows:

!<layer name>!.upper()

In this example, the expression reads:

!Layer!.upper()
The Expression section showing the full expression for the example: !Layer!.uppercase()
  1. Click Run. When the tool completes, all the lower case letters of the field are converted to upper case.
The attribute table with the Layer field highlighted showing all the letters are now upper case.
  1. Click the Save Edits button The Save Edits button in the Calculate Field pane to save the changes.

文章 ID:000022761

从 ArcGIS 专家处获得帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项

相关信息

发现关于本主题的更多内容