Lines Matching refs:width
24 function testStrimwidthWithMarker($string, $trimmark, $start, $width, $encoding) {
25 $result = mb_strimwidth($string, $start, $width, $trimmark, $encoding);
26 print "start=$start width=$width result=[";
29 print " width=" . mb_strwidth($result, $encoding) . "\n";
32 function testStrimwidth($string, $start, $width, $encoding) {
33 …testStrimwidthWithMarker($string, mb_convert_encoding('...', $encoding, 'ASCII'), $start, $width, …
42 print "String width: " . mb_strwidth($utf16le, 'UTF-16LE') . "\n";
49 // OK, now the string will just barely fit in the allowed width...
58 // What if we expect an output width of zero?
59 // (It will still output the trim marker, pushing the width beyond the stipulated 'maximum')
62 // Or output width of one?
66 // OK, let's count back 3 characters from the end of the string, then allow a width of 5
70 // Let's also try a negative width
71 // We'll count back 4 characters, then allow a width of ((4 * 2) - 2) = 6
73 // will have to be added, and will consume a width of 3
82 print "String width: " . mb_strwidth($euc_jp, 'EUC-JP') . "\n";
86 // Cut down to a width of 15, which is 10 characters in this case.
90 // With max width of 100, trim marker will not be added
96 // Count 30 characters back from end of string, then limit to width of 5
97 // Since width of trim marker is 3, this will only get a single char from string
104 // Skip 15 characters, which leaves a total width of 42. Then trim string down
105 // to 5 less than that, which is a width of 37.
108 // Take the last 30 characters, which have a width of 54. Trim string down to
116 // Take the last 10 characters, which have a width of 20. Trim string down to
117 // 12 less than that, which is a width of 8.
145 for ($width = -5; $width <= 5; $width++) {
146 if ($from < 0 && $width < 0 && $width < $from) {
150 mb_strimwidth($str, $from, $width, '...', 'ASCII');
159 $result = mb_strimwidth($str, $from, $width, '...', 'ASCII');
161 if ($from < 0 && $width < 0 && ($width - $from) <= 3) {
163 … been trim marker. string=" . $str . " result=" . $result . " from=" . $from . " width=" . $width);
167 if ($width < 0 || $width > 3) {
169 …he expected point! string=" . $str . " result=" . $result . " from=" . $from . " width=" . $width);
172 if ($width >= 3 && ($from >= 0 || $width <= abs($from))) {
173 if (mb_strwidth($result, 'ASCII') !== $width)
174 …nt from requested. string=" . $str . " result=" . $result . " from=" . $from . " width=" . $width);
177 if ($width < 0) {
180 if (mb_substr($result, -4, 1, 'ASCII') !== mb_substr($str, $width-4, 1, 'ASCII'))
181 …he expected point. string=" . $str . " result=" . $result . " from=" . $from . " width=" . $width);
188 // through when requested width=0
203 // it was wider than requested width, if the trim marker string was wider than
212 // combined with negative 'width' argument correctly when portion being skipped
220 String width: 14
224 start=0 width=100 result=[3100 3200 3300 6100 6200 6300 226f 575b 4b30 6a30] length=10 width=14
225 start=0 width=14 result=[3100 3200 3300 6100 6200 6300 226f 575b 4b30 6a30] length=10 width=14
226 start=0 width=13 result=[3100 3200 3300 6100 6200 6300 226f 575b 2e00 2e00 2e00] length=11 width=13
227 start=0 width=12 result=[3100 3200 3300 6100 6200 6300 226f 2e00 2e00 2e00] length=10 width=11
228 start=0 width=0 result=[2e00 2e00 2e00] length=3 width=3
229 start=0 width=1 result=[2e00 2e00 2e00] length=3 width=3
230 start=-3 width=5 result=[575b 2e00 2e00 2e00] length=4 width=5
231 start=-4 width=-2 result=[226f 2e00 2e00 2e00] length=4 width=5
235 String width: 68
239 start=0 width=15 result=[30 31 32 33 a4b3 a4ce cab8 bbfa 2e 2e 2e] length=11 width=15
240 …width=100 result=[30 31 32 33 a4b3 a4ce cab8 bbfa cef3 a4cf c6fc cbdc b8ec a4c7 a4b9 a1a3 45 55 43…
241 …t=15 width=100 result=[a1a3 45 55 43 2d 4a 50 a4f2 bbc8 a4c3 a4c6 a4a4 a4de a4b9 a1a3 c6fc cbdc b8…
242 start=-30 width=5 result=[a4cf 2e 2e 2e] length=4 width=5
243 start=9 width=5 result=[a4cf 2e 2e 2e] length=4 width=5
244 start=15 width=-5 result=[a1a3 45 55 43 2d 4a 50 a4f2 bbc8 a4c3 a4c6 a4a4 a4de a4b9 a1a3 c6fc cbdc …
245 start=-30 width=-25 result=[a4cf c6fc cbdc b8ec a4c7 a4b9 a1a3 45 55 43 2d 4a 50 a4f2 bbc8 a4c3 2e …
246 start=39 width=10 result=[] length=0 width=0
247 start=-10 width=-12 result=[a1a3 c6fc 2e 2e 2e] length=5 width=7
248 mb_strimwidth(): Argument #3 ($width) is out of range
251 mb_strimwidth(): Argument #3 ($width) is out of range
254 start=1 width=0 result=[2e 2e 2e] length=3 width=3
255 …width=255 result=[61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61…
256 start=0 width=10 result=[3f 3f 3f] length=3 width=3
257 start=0 width=10 result=[61 62 63 64 65 66 67 80 80 80] length=10 width=10
258 start=0 width=1 result=[61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70] length=16 width=16
259 start=-3 width=10 result=[61 62 63] length=3 width=3
260 start=3 width=-1 result=[61 62 2e 2e 2e] length=5 width=5