You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/classes/String.xml
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -118,13 +118,14 @@
118
118
</method>
119
119
<methodname="chr"qualifiers="static">
120
120
<returntype="String" />
121
-
<paramindex="0"name="char"type="int" />
121
+
<paramindex="0"name="code"type="int" />
122
122
<description>
123
-
Returns a single Unicode character from the decimal [param char]. You may use [url=https://unicodelookup.com/]unicodelookup.com[/url] or [url=https://www.unicode.org/charts/]unicode.org[/url] as points of reference.
123
+
Returns a single Unicode character from the integer [param code]. You may use [url=https://unicodelookup.com/]unicodelookup.com[/url] or [url=https://www.unicode.org/charts/]unicode.org[/url] as points of reference.
124
124
[codeblock]
125
125
print(String.chr(65)) # Prints "A"
126
126
print(String.chr(129302)) # Prints "🤖" (robot face emoji)
127
127
[/codeblock]
128
+
See also [method unicode_at], [method @GDScript.char], and [method @GDScript.ord].
128
129
</description>
129
130
</method>
130
131
<methodname="contains"qualifiers="const">
@@ -1149,6 +1150,7 @@
1149
1150
<paramindex="0"name="at"type="int" />
1150
1151
<description>
1151
1152
Returns the character code at position [param at].
1153
+
See also [method chr], [method @GDScript.char], and [method @GDScript.ord].
[b]Note:[/b] If [member ProjectSettings.editor/export/convert_text_resources_to_binary] is [code]true[/code], [method @GDScript.load] will not be able to read converted files in an exported project. If you rely on run-time loading of files present within the PCK, set [member ProjectSettings.editor/export/convert_text_resources_to_binary] to [code]false[/code].
176
176
</description>
177
177
</method>
178
+
<methodname="ord">
179
+
<returntype="int" />
180
+
<paramindex="0"name="char"type="String" />
181
+
<description>
182
+
Returns an integer representing the Unicode code point of the given character [param char], which should be a string of length 1.
183
+
[codeblock]
184
+
print(ord("A")) # Prints 65
185
+
print(ord("🤖")) # Prints 129302
186
+
[/codeblock]
187
+
This is the inverse of [method char]. See also [method String.chr] and [method String.unicode_at].
0 commit comments