/
z_convert.html
160 lines (134 loc) · 7.63 KB
/
z_convert.html
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Module z_convert</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
</head>
<body bgcolor="white">
<div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<hr>
<h1>Module z_convert</h1>
<ul class="index"><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>Conversion functions for all kinds of data types.
<p>Copyright © Copyright (c) 2008-2009 Rusty Klophaus, Copyright (c) 2009 Marc Worrell
</p>
<p><b>Authors:</b> Rusty Klophaus.</p>
<h2><a name="description">Description</a></h2>Conversion functions for all kinds of data types. Changes to
Rusty's version: added date conversion, undefined handling and more
to_bool cases.
<h2><a name="index">Function Index</a></h2>
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#clean_lower-1">clean_lower/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#convert_json-1">convert_json/1</a></td><td>Convert json from facebook favour to an easy to use format for zotonic templates.</td></tr>
<tr><td valign="top"><a href="#ip_to_list-1">ip_to_list/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#ip_to_long-1">ip_to_long/1</a></td><td>Convert an IP address from a string, IPv4 tuple or IPv6 tuple to the
big endian integer representation.</td></tr>
<tr><td valign="top"><a href="#long_to_ip-1">long_to_ip/1</a></td><td>Convert long int to IP address tuple.</td></tr>
<tr><td valign="top"><a href="#to_atom-1">to_atom/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#to_binary-1">to_binary/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#to_bool-1">to_bool/1</a></td><td>Quite loose conversion of values to boolean.</td></tr>
<tr><td valign="top"><a href="#to_bool_strict-1">to_bool_strict/1</a></td><td>Convert values to boolean values according to the Django rules.</td></tr>
<tr><td valign="top"><a href="#to_date-1">to_date/1</a></td><td>Convert an input to a date.</td></tr>
<tr><td valign="top"><a href="#to_datetime-1">to_datetime/1</a></td><td>Convert an input to a datetime, using to_date/1 and to_time/1.</td></tr>
<tr><td valign="top"><a href="#to_flatlist-1">to_flatlist/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#to_float-1">to_float/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#to_integer-1">to_integer/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#to_isotime-1">to_isotime/1</a></td><td>Convert a datetime (in local time) to an ISO time string (in universal time).</td></tr>
<tr><td valign="top"><a href="#to_json-1">to_json/1</a></td><td>Convert an Erlang structure to a format that can be serialized by mochijson.</td></tr>
<tr><td valign="top"><a href="#to_list-1">to_list/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#to_localtime-1">to_localtime/1</a></td><td>Convert a utc date time to local.</td></tr>
<tr><td valign="top"><a href="#to_time-1">to_time/1</a></td><td>Convert an input to a time.</td></tr>
<tr><td valign="top"><a href="#to_utc-1">to_utc/1</a></td><td>Convert a local date time to utc.</td></tr>
<tr><td valign="top"><a href="#unicode_to_utf8-1">unicode_to_utf8/1</a></td><td></td></tr>
</table>
<h2><a name="functions">Function Details</a></h2>
<h3 class="function"><a name="clean_lower-1">clean_lower/1</a></h3>
<div class="spec">
<p><tt>clean_lower(L) -> any()</tt></p>
</div>
<h3 class="function"><a name="convert_json-1">convert_json/1</a></h3>
<div class="spec">
<p><tt>convert_json(L) -> any()</tt></p>
</div><p>Convert json from facebook favour to an easy to use format for zotonic templates.</p>
<h3 class="function"><a name="ip_to_list-1">ip_to_list/1</a></h3>
<div class="spec">
<p><tt>ip_to_list(IPv6) -> any()</tt></p>
</div>
<h3 class="function"><a name="ip_to_long-1">ip_to_long/1</a></h3>
<div class="spec">
<p><tt>ip_to_long(X1::Address) -> {ok, integer()} | {error, badmatch}</tt><br></p>
</div><p>Convert an IP address from a string, IPv4 tuple or IPv6 tuple to the
big endian integer representation.</p>
<h3 class="function"><a name="long_to_ip-1">long_to_ip/1</a></h3>
<div class="spec">
<p><tt>long_to_ip(L) -> any()</tt></p>
</div><p>Convert long int to IP address tuple. FIXME: ipv6</p>
<h3 class="function"><a name="to_atom-1">to_atom/1</a></h3>
<div class="spec">
<p><tt>to_atom(A) -> any()</tt></p>
</div>
<h3 class="function"><a name="to_binary-1">to_binary/1</a></h3>
<div class="spec">
<p><tt>to_binary(A) -> any()</tt></p>
</div>
<h3 class="function"><a name="to_bool-1">to_bool/1</a></h3>
<div class="spec">
<p><tt>to_bool(V) -> any()</tt></p>
</div><p>Quite loose conversion of values to boolean</p>
<h3 class="function"><a name="to_bool_strict-1">to_bool_strict/1</a></h3>
<div class="spec">
<p><tt>to_bool_strict(M) -> any()</tt></p>
</div><p>Convert values to boolean values according to the Django rules</p>
<h3 class="function"><a name="to_date-1">to_date/1</a></h3>
<div class="spec">
<p><tt>to_date(D) -> any()</tt></p>
</div><p>Convert an input to a date.</p>
<h3 class="function"><a name="to_datetime-1">to_datetime/1</a></h3>
<div class="spec">
<p><tt>to_datetime(DT) -> any()</tt></p>
</div><p>Convert an input to a datetime, using to_date/1 and to_time/1.</p>
<h3 class="function"><a name="to_flatlist-1">to_flatlist/1</a></h3>
<div class="spec">
<p><tt>to_flatlist(L) -> any()</tt></p>
</div>
<h3 class="function"><a name="to_float-1">to_float/1</a></h3>
<div class="spec">
<p><tt>to_float(A) -> any()</tt></p>
</div>
<h3 class="function"><a name="to_integer-1">to_integer/1</a></h3>
<div class="spec">
<p><tt>to_integer(A) -> any()</tt></p>
</div>
<h3 class="function"><a name="to_isotime-1">to_isotime/1</a></h3>
<div class="spec">
<p><tt>to_isotime(DateTime) -> string()</tt><br></p>
</div><p>Convert a datetime (in local time) to an ISO time string (in universal time).</p>
<h3 class="function"><a name="to_json-1">to_json/1</a></h3>
<div class="spec">
<p><tt>to_json(X) -> any()</tt></p>
</div><p>Convert an Erlang structure to a format that can be serialized by mochijson.
</p>
<h3 class="function"><a name="to_list-1">to_list/1</a></h3>
<div class="spec">
<p><tt>to_list(L) -> any()</tt></p>
</div>
<h3 class="function"><a name="to_localtime-1">to_localtime/1</a></h3>
<div class="spec">
<p><tt>to_localtime(D) -> any()</tt></p>
</div><p>Convert a utc date time to local</p>
<h3 class="function"><a name="to_time-1">to_time/1</a></h3>
<div class="spec">
<p><tt>to_time(D) -> any()</tt></p>
</div><p>Convert an input to a time.</p>
<h3 class="function"><a name="to_utc-1">to_utc/1</a></h3>
<div class="spec">
<p><tt>to_utc(D) -> any()</tt></p>
</div><p>Convert a local date time to utc</p>
<h3 class="function"><a name="unicode_to_utf8-1">unicode_to_utf8/1</a></h3>
<div class="spec">
<p><tt>unicode_to_utf8(List) -> any()</tt></p>
</div>
<hr>
<div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<p><i>Generated by EDoc, Apr 11 2012, 20:41:27.</i></p>
</body>
</html>