Format: echo-e "\033[word background color; font color m string \033[control code"If you simply display the font color can be fixed control code bit 0m.Format: echo-e "\033[word background color; font Color m string \033[0m"Word background color range: 40-49 40: Black41: Crimson42: Green43: Yellow44: Blue45: Purple46: Dark Green47: WhiteWord Color: 30-3930: Black31: Red32: Green33: Yellow34: Blue35: Purple36: Dark Green37: WhiteANSI Control code \33[0m Close All properties\33[01m Setting Hig
problemSuppose there are arraysElement[]Array= {New Element(1),New Element(2),New Element(3)};How do you convert it to arraylistEssence Answerarrays asList array Arrays.aslist(new Element (1), new Element (2), new Element (3))However, there are some pits to be aware of:1. The list to be generated is fixed length. In other words, if you do add or remove to it, it will throw unsupportedoperationexception. 2, if you modify the value of the array, the corresponding value in the list will also
because of the background interface qualification, the form content must be converted to a JSON string submission, thus writing a function that transforms the form's form value into a JSON string. premise: The page introduces jquery directly below the codeOne, the code /** 表单序列化成json字符串的方法 */ function form2JsonString(formId) { var paramArray = $(‘#‘ + formId).serializeArray(); /*请求参数转json对象*/ var jsonObj={}; $(paramArray).each(function(){ jsonObj[this.name]=this.value; })
for compatibility reasons(although it is not encouraged in the new code). It is recommended that all people seeking this function useThe split method of String or the Java.util.regex packagepublic static string[] ConvertStrToArray2 (String str) {StringTokenizer st = new StringTokenizer (str, ",");//Put "," as a partition flag, and then assign the well-divided character to the StringTokenizer object.string[] Strarray = new String[st.counttokens ()];//evaluates the StringTokenizer method of the C
1 varStr=' Break the Million! He's been on the 40-year feat.2 The great God uses the ice to build the dog to be anaconda the water3 three dogs look at three-person bar staged full conclaves4 Pet Monkey help wash dishes sea lions sell cute fish5 the 1th issue of "Ka ka/wild chat ball"6 Gigi Beautiful leg seconds kill the red flower7 The subsidized of the earthquake hero Lin Hao appeared in the art8 Brazilian medical team: Neymar injury three months9Wu Dajing and other Winter Olympic athletes to t
get a nan. The time to construct this is: 2013/03/08 00:00:00. You can also pass in hours, minutes, and seconds, but not just the hours, such as "2013/03/08 17", and the parameters will also get a Nan. The parameter can be "2013/03/08 17:20" or "2013/03/08 17:20:05", so that you can get the correct time, where if the number of seconds is not given, the default is 0.At this point the date data is obtained, if you want to get the so-called timestamp, you can:var time = Date.gettime ();This gets a
are several simple ways to get rid of fractional parts to convert decimals into integers, listed belowThe second kind: Two-time inversion, the same is the use of bit operation conversion principle. var integer = ~~decimal; 4 = ~~4.123The third type: mathematical functions that take integers up and down, Math.ceil and Math.floorvar integer = decimal >= 0? Math.floor (decimal): Math.ceil (decimal);Of course there are more complicated ways, but after the Robert Koritnik test, or with 0 or the way
}) +\b)/g ' What do you mean1. First, the global match2. Match non-word boundaries3. Non-word boundaries are followed (3 consecutive integers are numbered and word boundaries are added)4. Continuous numbers are not captured"123456789". Replace (/\b (? = (?: \ D{3}) +\b)/g, ', ') 'Execution process:The Replace function makes multiple matches, and \b represents the word boundary to match.1. First start from the middle of 1 and 2 but there are 8 numbers in the back that do not meet the forward-look
In daily programming--including dialogs, relational databases, financial procedures, SMS programs, and all procedures for handling data files--it is common to control decimal places after decimals, and this article will explain how to use simple methods to control decimal places, and also to uncover a little bit of secrecy about string and data precision.The derivation of the problemIf you have a function that accepts a long double argument and converts
This example describes the way PHP converts date formats to XX days. Share to everyone for your reference. Specifically as follows:
This code can format the time 3 days ago, 5 seconds ago, 2 years ago.
Convert a date into a string "tells how long"//That date is ... eg:2 days ago, 3 minutes ago.
Function ago ($d) {$c = getdate ();
$p = Array (' Year ', ' mon ', ' mday ', ' hours ', ' minutes ', ' seconds ');
$display = Array (' Year ', ' Month
This example describes the way PHP converts strings to 16. Share to everyone for your reference. The specific analysis is as follows:
In PHP, you can convert a string into a 16-form output using the Bin2Hex function, and the Bin2Hex () function returns the ASCII code
The output results are as follows:
Hello world!
48656c6c6f09776f726c64210a
I hope this article will help you with your PHP program design.
This article illustrates how PHP converts a text file to a CSV output. Share to everyone for your reference. The implementation methods are as follows:
This class provides a quick, easy way to convert a fixed-width CSV file, and it can be used to perform iterations, making it very efficient for an iteration to know only the current member, the option is provided to the specified line character and the field delimiter end, this splfileobject Files. Th
1. Iconv () Introduction
The Iconv function converts a known character set file to another known character set file. For example: Convert from GB2312 to UTF-8.
The Iconv function is built into the PHP5, and the GB character set is opened by default.
2. Iconv () Error
Iconv error in converting the character "-" to gb2312, the solution is to add "//ignore" after the desired encoding, which is the Iconv function after the second parameter. as follows:
into an integer after the execution.
4. Explanation: Why (5) (6) execution is performed to convert 070 to integers, but the result is different? This is also the 2nd way to solve the problem of how to get the disadvantage.
Because I saw in the official document that the if string was not a string, then it was converted to one. This passage. This means that if the argument is not a string, it converts it to a string and then to an integer. For examp
The example in this article describes the way PHP converts HTML to a WAP markup language for WML. Share to everyone for your reference. The implementation method is as follows:
I hope this article will help you with your PHP programming.
This article illustrates how PHP converts a picture file into binary output. Share to everyone for your reference. The implementation methods are as follows:
Header ("Content-type:image/jpeg");
$PSize = filesize (' 1.jpg ');
$picturedata = Fread (fopen (' 1.jpg ', "R"), $PSize);
Echo $picturedata;
As simple as 4 lines of code, the picture is exported as a binary stream to the client, and there is no difference between opening a picture.
It
This article illustrates the way Python converts objectid in MongoDB to timestamps. Share to everyone for your reference. The specific analysis is as follows:
The first four bits of the _id field in MongoDB are the 16-bit timestamp, which makes it easy to extract the timestamp from the _id by using Python
def timestamp_from_objectid (objectid): Result
= 0
Try: Result
= Time.mktime (objectid.generation_ Time.timetuple ())
except: Pass return
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.