forked from lep/jassdoc
/
string.j
140 lines (104 loc) · 3.23 KB
/
string.j
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// String Utility API
/**
@pure
*/
native I2R takes integer i returns real
/**
@pure
*/
native R2I takes real r returns integer
/**
@pure
*/
native I2S takes integer i returns string
/**
@pure
*/
native R2S takes real r returns string
/**
Formats the real r into a string with supplied precision and width.
@param r The number to be converted
@param width The width of the string. If the width of the resulting conversion
is too small the string will be filled with spaces.
Use 0 for no padding.
@param precision The amount of decimal places.
@pure
*/
native R2SW takes real r, integer width, integer precision returns string
/**
Converts a string of digits to the represented number.
Returns `0` in case of an error.
@param s The string to be converted
@note This function only works for decimal strings. Hexadecimal or octal strings
are not supported.
@note If the input string starts with some valid input but ends in invalid input
this will return the conversion of the valid part: `S2I("123asd") == 123`.
@pure
*/
native S2I takes string s returns integer
/**
Converts a string of digits to the represented number.
Returns `0` in case of an error.
@param s The string to be converted
@note This function only works for decimal strings. Hexadecimal or octal strings
are not supported.
@note If the input string starts with some valid input but ends in invalid input
this will return the conversion of the valid part: `S2R(".123asd") == 0.123`.
@pure
*/
native S2R takes string s returns real
/**
@patch 1.24b
*/
native GetHandleId takes handle h returns integer
/**
@pure
@note This function does bound-checking on the upper bound, e.g.
`SubString("test", 0, 9999) == "test"` but not on the lower bound:
````
SubString("", -3, 0) == null
SubString(null, -3, 0) == null
SubString("non-empty/not-null", -3, 0) != ""
SubString("non-empty/not-null", -3, 0) != null
````
<http://www.wc3c.net/showthread.php?p=1090749#post1090749>
*/
native SubString takes string source, integer start, integer end returns string
/**
Returns the length of the string in *bytes*.
@pure
*/
native StringLength takes string s returns integer
/**
@pure
*/
native StringCase takes string source, boolean upper returns string
/**
Case and slash insensitive hash function.
`StringHash("\\") == StringHash("/")`
`StringHash("AB") == StringHash("ab")`
@note See <http://www.hiveworkshop.com/forums/w-277/b-213272/> for the source-code of StringHash.
@pure
@patch 1.24b
*/
native StringHash takes string s returns integer
/**
Reads a string out of some files and returns the result.
The result can differ between players with different languages.
Possible sources are the .fdf files and the war3map.wts file.
Returns source if no entry was found.
@bug Cannot assign it to a constant variable as it will crash the game.
`constant string foo = GetLocalizedString("bar")`
@async
*/
native GetLocalizedString takes string source returns string
/**
Returns the `integer` hotkey for a specific game action à la `"GAMEOVER_QUIT_GAME"`.
You can look up potential values in `UI\FrameDef\GlobalStrings.fdf`.
@async
*/
native GetLocalizedHotkey takes string source returns integer
/**
@patch 1.32
*/
constant native ParseTags takes string taggedString returns string