STRING.inc
1.79 KB
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
<?php
//文字超過折り返し関数
function LINE_BR2($str,$len){
$split_line = split("\n",$str);
for ($i=0;$i<count($split_line); $i++) {
$strName="";
$strTempName="";
$line_count=1;
for ($j=0;$j<mb_strlen($split_line[$i]); $j++){
$strTempName .= mb_substr($split_line[$i],$j,1);
if (strlen($strTempName) >= $len){
$strName .= $strTempName."<br>";
$strTempName="";
$line_count+=1;
}
}
$split_line[$i]=$strName.$strTempName;
}
for ($i=0;$i<count($split_line)-1; $i++) {
$strles .= $split_line[$i]."<br>";
}
$strles .= $split_line[$i];
return $strles;
}
//文字超過折り返し関数
function LINE_BR($str,$len){
$split_line = split("<br />",nl2br($str));
$line_count=0;
for ($i=0;$i<count($split_line); $i++) {
$split_line[$i] = str_replace("\n","",$split_line[$i]);
$split_line[$i] = str_replace("\r","",$split_line[$i]);
$strTempName="";
for ($j=0;$j<mb_strlen($split_line[$i]); $j++){
$intLineFlg=0;
$strTempName .= mb_substr($split_line[$i],$j,1,"EUC-JP");
if (strlen($strTempName) >= $len){
$strName[$line_count] = $strTempName."<br>";
$strTempName="";
$line_count+=1;
$intLineFlg=1;
}
}
if($intLineFlg!=1){
$strName[$line_count] = $strTempName."<br>";
$strTempName = "";
$line_count+=1;
}
}
for ($i=0;$i<count($strName); $i++) {
$strles .= $strName[$i];
}
return $strles;
}
//長文ファイルチェック
function LINE_DEL($str,$len){
$strName="";
for ($ii=0;$ii<mb_strlen($str); $ii++) {
$strName .= mb_substr($str,$ii,1);
if (strlen($strName) >= $len){
if($ii==mb_strlen($str)-1){
}else{
$strName .= "...";
}
break;
}
}
return $strName;
}
?>