]# cat emp.txt 0001 Alen M 240002 Tiboo M 320003 Felix M 260004 Jack F 240005 Tim M 250006 Audi F 300007 Bobo F 320008 Geo M 210009 Andy F 1900010 Peter M 28[root@strong sed_stu]#
1. Print: p command
-- Print the first line of information [root @ strong sed_stu] # sed '1p' emp.txt 0001 Alen M 240001 Alen M 240002 Tiboo M 320
Linux Message Queue source code-Linux general technology-Linux technology and application information. For more information, see the following section. The source code for sending messages in the message queue in linux. # What kind of behavior should I add alen when applying for a space? How much space is required?
Struct msg_msg * load_msg (const void _ user * src, int len)
{
Struct msg_msg * msg;
Struct msg_msgseg ** using G;
Int err;
Int
Php Chinese string intercepting php Chinese string code
/**
@ Truncate a Chinese string for GB2312 encoding
@ Http://bbs.it-home.org
*/
Function FSubstr ($ title, $ start, $ len = "", $ magic = true)
{
$ Length = 0;
If ($ len = "") $ len = strlen ($ title );
// Judge the starting position as incorrect
If ($ start> 0)
{
$ Cnum = 0;
For ($ I = 0; $ I
{
If (ord (substr ($ title, $ I, 1) >=
utf8Substr ($ str, $ from, $ len){Return preg_replace ('# ^ (? : [X00-x7F] | [xC0-xFF] [x80-xBF] +) {0, '. $ from .'}'.'((? : [X00-x7F] | [xC0-xFF] [x80-xBF] +) {0, '. $ len.'}). * # s ','$ 1', $ str );}
The uft8 string can be intercepted separately.
Program description:
1. the len parameter is based on Chinese characters. 1len is equal to 2 English characters.
2. if the magic parameter is set to false, the Chinese character and English character count are equivalent.
3. special characte
.2. if the magic parameter is set to false, the Chinese character and English character count are equivalent.3. special character strings that have been encoded with htmlspecialchars ()4. correct handling of the GB2312 entity character mode)
Program code:
Function FSubstr ($ title, $ start, $ len = "", $ magic = true){/*** Powered by Smartpig* Mailto: d.einstein@263.net*/ $ Length = 0;If ($ len = "") $ len = strlen ($ title );
// Judge the starting position as incorrectIf ($ start> 0){$ Cnum = 0
that have been encoded with htmlspecialchars ()4. correct handling of the GB2312 entity character mode)
Program code:
Function FSubstr ($ title, $ start, $ len = "", $ magic = true){/*** Powered by Smartpig* Mailto: d.einstein@263.net*/$ Length = 0;If ($ len = "") $ len = strlen ($ title );
// Judge the starting position as incorrectIf ($ start> 0){$ Cnum = 0;For ($ I = 0; $ I {If (ord (substr ($ title, $ I, 1) >=128) $ cnum ++;}If ($ cnum % 2! = 0) $ start --;Unset ($ cnum );}
If (strlen ($ ti
= $i +1; Actual byte count of 1
$n = $n +0.5; Lowercase letters and half-width punctuation and so on with half a high character justifies ...
}
}
if ($str _length> $cutlength) {
$returnstr = $returnstr. "...";//Add ellipses at the end of the length
}
return $returnstr;
}
Intercept Utf-8 String Functions
Copy to ClipboardWhat to refer to:
[www.bkjia.com]function Fsubstr ($title, $start, $len = "", $magic =true)
{
if ($len = = "") $len =strlen ($title);
if ($start! = 0)
{
$startv = Ord (substr
)
Create a user table, name, and password two fieldsmysql> CREATE TABLE User (name VARCHAR, password VARCHAR (20)); Query OK, 0 rows affected (0.27 sec)
Inserting several data into the user tablemysql> INSERT into user values (' Tom ', ' 1321 ');Query OK, 1 row affected (0.05 sec)
mysql> INSERT into user values (' Alen ', ' 7875 ');Query OK, 1 row affected (0.08 sec)
mysql> INSERT into user values (' Jack ', ' 7455 ');Query OK, 1 row affected
There are two sorted arrays A and B of size M and N respectively. find the median of the two sorted arrays. the overall run time complexity shoshould be O (log (m + n )).
1 public class Solution { 2 public double findMedianSortedArrays(int A[], int B[]) { 3 int alen = A.length; 4 int blen = B.length; 5 if((alen + blen) % 2 == 1) return findKthElement(A, B, 0,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.