---
title: Character.ToNumber – แปลงอักขระเป็นรหัส Unicode
url: https://www.thepexcel.com/functions/power-query/text-functions/character-tonumber/
type: function-explainer
program: Power Query
syntax: Character.ToNumber(character as nullable text) as nullable number
date: 2025-12-04
updated: 2025-12-17
scores:
  popularity: 5
  difficulty: 3
  usefulness: 5
---

# Character.ToNumber – แปลงอักขระเป็นรหัส Unicode

> แปลงอักขระเป็นรหัส Unicode

## คำอธิบาย

Character.ToNumber ใช้สำหรับแปลงอักขระเป็นรหัส Unicode ที่สอดคล้องกัน โดยการคำนวณรหัส Unicode 21-bit เป็นประโยชน์สำหรับการเปรียบเทียบ ตรวจสอบ และวิเคราะห์อักขระ

## Syntax

```excel
Character.ToNumber(character as nullable text) as nullable number
```

## Arguments

| Name | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| character | Yes | nullable text |  | อักขระตัวเดียวที่ต้องการแปลงเป็นค่ารหัส Unicode |

## เคสการใช้งาน

### ตรวจสอบว่าอักขระเป็นตัวอักษร ตัวเลข หรือสัญลักษณ์

ตรวจสอบว่าอักขระเป็นตัวอักษร ตัวเลข หรือสัญลักษณ์

### เปรียบเทียบและเรียงลำดับอักขระตามรหัส

เปรียบเทียบและเรียงลำดับอักขระตามรหัส

### ตรวจสอบแท็บ ขึ้นบรรทัด และตัวอักษรควบคุมอื่นๆ

ตรวจสอบแท็บ ขึ้นบรรทัด และตัวอักษรควบคุมอื่นๆ

## ตัวอย่าง

### 1. แปลง 'A' เป็นรหัส 65

```excel
Character.ToNumber("A")
```

**ผลลัพธ์:** `65`

ตัวอักษร 'A' (uppercase) มีรหัส Unicode 65

### 2. แปลง 'a' เป็นรหัส 97

```excel
Character.ToNumber("a")
```

**ผลลัพธ์:** `97`

ตัวอักษร 'a' (lowercase) มีรหัส Unicode 97

### 3. ตรวจสอบแท็บ

```excel
Character.ToNumber("#(tab)")
```

**ผลลัพธ์:** `9`

แท็บมีรหัส Unicode 9

## ฟังก์ชันที่เกี่ยวข้อง

- [Character.FromNumber – สร้างอักขระจากรหัส Unicode](https://www.thepexcel.com/functions/power-query/text-functions/character-fromnumber/)

## แหล่งข้อมูลเพิ่มเติม

- [Microsoft Learn: Character.ToNumber](https://learn.microsoft.com/en-us/powerquery-m/character-tonumber) _(Official Documentation)_

---

_Source: [https://www.thepexcel.com/functions/power-query/text-functions/character-tonumber/](https://www.thepexcel.com/functions/power-query/text-functions/character-tonumber/)_
