Unicode.AccentFold.html revision 7d9dd27c758ee750e3ea3b2cf2932691378d5cdd
<head>
</head>
<body id="yahoo-com">
<div id="doc3" class="yui-t2">
<div id="hd">
<h3>unicode <span class="subtitle">3.3.0</span></h3>
> Unicode.AccentFold
<form onsubmit="return false">
<div id="propertysearch">
Search: <input autocomplete="off" id="searchinput" />
<div id="searchresults">
</div>
</div>
</form>
</div>
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<form action="#" name="yui-classopts-form" method="get" id="yui-classopts-form">
<fieldset>
<legend>Filters</legend>
<span class="classopts"><input type="checkbox" name="show_private" id="show_private" /> <label for="show_private">Show Private</label></span>
<span class="classopts"><input type="checkbox" name="show_protected" id="show_protected" /> <label for="show_protected">Show Protected</label></span>
<span class="classopts"><input type="checkbox" name="show_deprecated" id="show_deprecated" /> <label for="show_deprecated">Show Deprecated</label></span>
</fieldset>
</form>
<h2>
<code>static</code>
<span class="extends">
</span>
</h2>
<!-- class tree goes here -->
<div class="summary description" property="yui:description">
<p>
Provides a basic Unicode accent folding implementation that converts common
accented letters (like "รก") to their non-accented forms (like "a").
</p>
<p>
This implementation is not comprehensive, and should only be used as a last
resort when accent folding can't be done on the server. A comprehensive
accent folding implementation would require much more character data to be
sent to the browser, resulting in a significant performance penalty. This
implementation strives for a compromise between usefulness and performance.
</p>
<p>
Accent folding is a destructive operation that can't be reversed, and may
change or destroy the actual meaning of the text depending on the language.
It should not be used on strings that will later be displayed to a user,
unless this is done with the understanding that linguistic meaning may be
lost and that you may in fact confuse or insult the user by doing so.
</p>
</div>
<div rel="yui:properties" resource="#properties">
</div>
<div rel="yui:methods" resource="#methods">
<div class="section method details">
<h3 id="methods">Methods</h3>
<div class="content">
<div class="" rel="yui:method" resource="#method_canFold">
<h4>
<a name="method_canFold">canFold</a></h4>
<div class="detail" >
<code>
static
Boolean
<strong property="yui:name">canFold</strong>
(
string
)
</code>
<div class="description" property="yui:description">
Returns <code>true</code> if the specified string contains one or more
characters that can be folded, <code>false</code> otherwise.
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">string</span>
<<span property="yui:type">String</span>>
</code>
<span property="yui:description"> String to test.</span>
</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_compare">
<h4>
<a name="method_compare">compare</a></h4>
<div class="detail" >
<code>
static
Boolean
<strong property="yui:name">compare</strong>
(
a
,
b
,
func
)
</code>
<div class="description" property="yui:description">
Compares the accent-folded versions of two strings and returns
<code>true</code> if they're the same, <code>false</code> otherwise. If
a custom comparison function is supplied, the accent-folded strings will
be passed to that function for comparison.
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">a</span>
<<span property="yui:type">String</span>>
</code>
<span property="yui:description"> First string to compare.</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">b</span>
<<span property="yui:type">String</span>>
</code>
<span property="yui:description"> Second string to compare.</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">func</span>
<<span property="yui:type">Function</span>>
</code>
<span property="yui:description"> (optional) Custom comparison function. Should
return a truthy or falsy value.</span>
</dd>
</dl>
<dl>
<dt>Returns:
<code property="yui:return">
Boolean
</code></dt>
<dd property="yui:returnInfo">Results of the comparison.</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_filter">
<h4>
<a name="method_filter">filter</a></h4>
<div class="detail" >
<code>
static
Array
<strong property="yui:name">filter</strong>
(
haystack
,
func
)
</code>
<div class="description" property="yui:description">
<p>
Returns a copy of <em>haystack</em> containing only the strings for which
the supplied function returns <code>true</code>.
</p>
<p>
While comparisons will be made using accent-folded strings, the returned
array of matches will contain the original strings that were passed in.
</p>
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">haystack</span>
<<span property="yui:type">Array</span>>
</code>
<span property="yui:description"> Array of strings to filter.</span>
</dd>
<dd rel="yui:parameter">
<code><span property="yui:name">func</span>
<<span property="yui:type">Function</span>>
</code>
<span property="yui:description"> Comparison function. Will receive an accent-folded
haystack string as an argument, and should return a truthy or falsy
value.</span>
</dd>
</dl>
<dl>
<dt>Returns:
<code property="yui:return">
Array
</code></dt>
<dd property="yui:returnInfo">Filtered copy of <em>haystack</em>.</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="" rel="yui:method" resource="#method_fold">
<h4>
<a name="method_fold">fold</a></h4>
<div class="detail" >
<code>
static
String|Array
<strong property="yui:name">fold</strong>
(
input
)
</code>
<div class="description" property="yui:description">
Accent-folds the specified string or array of strings and returns a copy
in which common accented letters have been converted to their closest
non-accented, lowercase forms.
</div>
<div class="description">
<dl rel="yui:parameters">
<dt>Parameters:</dt>
<dd rel="yui:parameter">
<code><span property="yui:name">input</span>
<<span property="yui:type">String|Array</span>>
</code>
<span property="yui:description"> String or array of strings to be folded.</span>
</dd>
</dl>
<dl>
<dt>Returns:
<code property="yui:return">
String|Array
</code></dt>
<dd property="yui:returnInfo">Folded string or array of strings.</dd>
</dl>
</div>
</div>
<hr />
</div>
</div>
</div>
</div>
<div rel="yui:events" resource="#events">
</div>
<div rel="yui:attributes" resource="#configattributes">
</div>
</div>
</div>
<div class="yui-b">
<div class="nav">
<div id="moduleList" class="module">
<h4>Modules</h4>
<ul class="content">
<li class=""><a href="module_classnamemanager.html" title="classnamemanager">classnamemanager</a></li>
<li class=""><a href="module_event-valuechange.html" title="event-valuechange">event-valuechange</a></li>
<li class=""><a href="module_history-deprecated.html" title="history-deprecated">history-deprecated</a></li>
<li class=""><a href="module_node-focusmanager.html" title="node-focusmanager">node-focusmanager</a></li>
<li class=""><a href="module_scrollview-paginator.html" title="scrollview-paginator">scrollview-paginator</a></li>
<li class=""><a href="module_scrollview-scrollbars.html" title="scrollview-scrollbars">scrollview-scrollbars</a></li>
<li class=""><a href="module_widget-position-align.html" title="widget-position-align">widget-position-align</a></li>
<li class=""><a href="module_widget-position-constrain.html" title="widget-position-constrain">widget-position-constrain</a></li>
</ul>
</div>
<div id="classList" class="module">
<h4>Classes</h4>
<ul class="content">
<li class="selected"><a href="Unicode.AccentFold.html" title="Unicode.AccentFold">Unicode.AccentFold</a></li>
<li class=""><a href="Unicode.Data.AccentFold.html" title="Unicode.Data.AccentFold">Unicode.Data.AccentFold</a></li>
<li class=""><a href="Unicode.Data.WordBreak.html" title="Unicode.Data.WordBreak">Unicode.Data.WordBreak</a></li>
</ul>
</div>
<div id="fileList" class="module">
<h4>Files</h4>
<ul class="content">
<li class=""><a href="unicode-accentfold.js.html" title="unicode-accentfold.js">unicode-accentfold.js</a></li>
<li class=""><a href="unicode-data-accentfold.js.html" title="unicode-data-accentfold.js">unicode-data-accentfold.js</a></li>
<li class=""><a href="unicode-data-wordbreak.js.html" title="unicode-data-wordbreak.js">unicode-data-wordbreak.js</a></li>
<li class=""><a href="unicode-wordbreak.js.html" title="unicode-wordbreak.js">unicode-wordbreak.js</a></li>
</ul>
</div>
<div id="methodsList" class="module">
<h4>Methods</h4>
<ul class="content">
<li class=""><a href="#method_canFold" title="canFold">canFold</a></li>
<li class=""><a href="#method_compare" title="compare">compare</a></li>
<li class=""><a href="#method_filter" title="filter">filter</a></li>
<li class=""><a href="#method_fold" title="fold">fold</a></li>
</ul>
</div>
</div>
</div>
</div>
<div id="ft">
<hr />
Copyright © 2010 Yahoo! Inc. All rights reserved.
</div>
</div>
<script type="text/javascript">
var ALL_YUI_PROPS = [{"access": "", "host": "Unicode.AccentFold", "name": "canFold", "url": "Unicode.AccentFold.html#method_canFold", "type": "method"}, {"access": "", "host": "Unicode.AccentFold", "name": "compare", "url": "Unicode.AccentFold.html#method_compare", "type": "method"}, {"access": "", "host": "Unicode.AccentFold", "name": "filter", "url": "Unicode.AccentFold.html#method_filter", "type": "method"}, {"access": "", "host": "Unicode.AccentFold", "name": "fold", "url": "Unicode.AccentFold.html#method_fold", "type": "method"}];
</script>
</body>
</html>