Lines Matching full:we

16   <p>When we manipulate strings, the <a href="http://unicode.org/">Unicode</a>
26 Unicode. Unfortunately, sometimes we have to mix these extensions to achieve
43 interfaces. We are going to use three examples in three different languages:
48 <p>Now, let's see what we can do on these three strings.</p>
52 <p>Let's start with <strong>elementary</strong> operations. If we would like
53 to <strong>count</strong> the number of characters (not bytes), we will use
67 <p>When we speak about text position, it is not suitable to speak about the
70 We can know this direction thanks to the
95 <p>If we would like to <strong>concatenate</strong> another string to the end
96 or to the beginning, we will respectively use the
107 <p>We also have the <code>Hoa\Ustring\Ustring::toLowerCase</code> and
116 <p>We can also add characters to the beginning or to the end of the string to
119 That's why we have the <code>Hoa\Ustring\Ustring::pad</code> method which
121 indicating whether we have to add at the end or at the beginning of the string
140 <p>If we would like to remove other characters, we can use its first argument
142 specify from what side we would like to remove character: at the beginning, at
146 <p>If we would like to remove other characters, we can use its first argument
150 <code>Hoa\Ustring\Ustring::END</code> constants. We can combine these
154 the spaces only at the end, we will write:</p>
156 <p>We can also <strong>reduce</strong> the string to a
166 <p>If we would like to get a specific character, we can rely on the
181 <p>If we would like the last character, we will use the -1 index. The index is
184 <p>We can also modify or remove a specific character with this method. For
204 <p>We can also transform from Arabic or Japanese to ASCII. Symbols, like
233 <p>We also find the <code>getTransliterator</code> method which returns a
235 not exist. This method takes a transliteration identifier as argument. We
243 <p>More generally, to change the <strong>encoding</strong> format, we can use
247 list of encoding formats, we have to refer to the
251 <p>To know if a string is encoded in UTF-8, we can use the
263 <p>We can <strong>split</strong> the string into several sub-strings by using
264 the <code>Hoa\Ustring\Ustring::split</code> method. As first argument, we have
270 last argument is set to <code>PREG_SPLIT_NO_EMPTY</code>. Thus, if we would
271 like to get all the words of a string, we will write:</p>
286 <p>If we would like to <strong>iterate</strong> over all the
302 <p>We notice that the iteration is based on the text direction, it means that
305 <p>Of course, if we would like to get an array of characters, we can use the
335 alphabetical order), 0 if it is identical and 1 if it comes after. If we
336 would like to use all the power of the underlying mechanism, we can call the
340 comparison without taking care of the other parameters). Thus, if we would
341 like to sort an array of strings, we will write:</p>
360 region etc. We can use the
363 <p>We can also know if a string <strong>matches</strong> a certain pattern,
364 still expressed with a regular expression. To achieve that, we will use the
369 support. We have the following parameters: the pattern, a variable passed by
371 indicating whether the search is global or not (respectively if we have to use
374 <p>Thus, we will check that our French example contains <code>aime</code> with
386 <p>Similarly, we can <strong>search</strong> and <strong>replace</strong>
388 regular expression. To achieve that, we will use the
393 Unicode support. As first argument, we find one or more patterns, as second
397 <p>Thus, we will modify our French example to be more polite:</p>
424 <p>Because they are strict aliases, we can write:</p>
438 a single Unicode character. We have already mentionned the
440 <strong>direction</strong> of a character. We also have the
460 <p>To get more semantics, we have the
463 <p>If we would like to count the number of columns necessary for a whole
464 string, we have to use the <code>Hoa\Ustring\Ustring::getWidth</code> method.
480 useful if we would like to know the length of a string to position it
486 <p>Finally, if this time we are not interested by Unicode characters but
488 1 byte), we have an extra operation. The
501 <p>If we compare these results with the ones of the
502 <code>Hoa\Ustring\Ustring::count</code> method, we understand that the Arabic
504 with 3 bytes. We can also get a specific byte thanks to the
511 <strong>code-point</strong>. To get the code-point of a character, we can
513 character based on its code-point, we can use the
514 <code>Hoa\Ustring\Ustring::fromCode</code> static method. We also have the
535 <p>We will study the <code>Hoa\Ustring\Search::approximated</code> algorithm
538 modification). Let's take the classical example of a DNA representation: We
540 1 difference (maximum) in <code>CAGATAAGAGAA</code>. So, we will write:</p>
567 <code>j</code> - <code>i</code>). Thus, we can compute the results by using
570 <p>With our example, we have four results. The first is <code>AGATA</code>,
580 <p>Another example, more concrete this time. We will consider the
582 possible options of a command line), and we will search <code>--testot</code>,
584 as it is. We will then use our search algorithm with at most 1 difference.
602 so we can suggest them to the user. This is a mechanism user by