The conversion string format is the character in the original string + the number of consecutive occurrences of the character. For example, 1233422222 is converted to 1121324125 (1 appears once, 2 appears once, 3 appears twice ......
Similar to this question: In a word list of ultra-large text, count the number of times each word appears.
Method:
Define two va
Because of the project requirements, the front-end time should display all the affiliated images of a product by page without considering Ajax requests. Therefore, we simply put all the images out at one time, then paging is performed during loading. Many jquery and property functions are implemented on the Internet, but many of their plug-in's ancillary functions are not required, and there is no need to reference this library for such a functional area, for the sake of speed, of course, your s
NSString + Check, iOS determines whether the mobile phone number format is correct
Usage: create a class that inherits from NSString, import the NSString + Check. h header file, and determine the value of the string (checkPhoneNumInput) YES or NO.
// NSString + Check. h
// Ics
//
// Created by Casystar on 15-4-2.
// Copyright (c) 2015 dong. All rights reserved.
//
# Import
@ Interface NSString (Check)
-
# I = 3# Username = "yangxiaoer"# Password = "123456"# While I> = 0:# Name = input ("Enter your Username :")# If name = Username:# Passwd = input ("enter your password :")# If passwd = password:# Print ("Logon successful. Please wait ")# Print ('''# Username: % s# Password: % s# ''' % (Username, password ))# Break# Else:# Print ("Your password is incorrect. Please enter it again ")# Print ("You still have % s chances" % (I-1 ))# If I = 0:# Print ('your chances are used up, end this operation ')#
public class Test {public static void Main (string[] args) {Int[] A = new int[400];Int[] B = new INT[50];for (int i = 0; i A[i] = (int) (Math.random () * 50);}System.out.println ("Randomly generated array is:");for (int i:a) {System.out.print (i+ "");}for (int i = 0; i for (int j = i + 1; j > 0; j--) {if (A[j] int temp = A[j];A[J] = a[j-1];A[J-1] = temp;}}}System.out.println ("\ n the sorted array is:");for (int i:a) {System.out.print (i+ "");}for (int i = 0; I int temp = 0;for (int j = 0 + temp
Integer (number of seconds) conversion last minute and second format (XX:XX:XX)
Copy Code code as follows:
A integer to Xx:xx:xx
public static String sectotime (int time) {
String timestr = null;
int hour = 0;
int minute = 0;
int second = 0;
if (Time return "00:00";
else {
minute = TIME/60;
if (minute Second = time% 60;
Timestr = Unitformat (minute) + ":" + unitformat (second);
} els
Tag:rettimestyledouble Get stringcolorintpublic Public String Timechange (double time ) { int hour= (int) (time/3600); int minute= (int) (time%3600/60); int second= (int) (time%3600%60); return (hour>10?) ("" +hour):("0" +hour) + ":" + (minute>10? ("") +minute):("0" +minute) + ":" + (second>10? ("") +second):("0" +second)); }Converts the number of seconds fetched from the database to the 00:00:00
How to format a number? For example, if I only want to get the number after the decimal point, it is 0.21951100. can I do this without using the explode function?
Reply to discussion (solution)
Convert to string type, and then use substring to extract digits after the decimal point.
Many methods Just give one
$ A = "0.21951100"; echo substr ($ a, strpos (
/*Purpose: Verify the format of IP addressInput: Strip:ip AddressReturns: False if return true through validation;*/Java code
1. function f_check_ip (obj)2. {3. Var re=/^ (d+). (d+). (d+). (d+) $/; Regular expressions that match an IP address4. if (Re.test (Obj.value))5. {6. If (regexp.$1 7.}8. F_alert (obj, "Please enter a legitimate computer IP address");9. return false;10.}11.
function F_check_ip (obj){var re=/^ (d+). (d+). (d+). (d+) $/; R
Note:
Recently, I plan to refine my Javascript code, so I have to temporarily discard the original good VBScript and fully use Jscript/Javascript.
We found that both VBs and Js have some functions that are not available on both sides...
For example, Js does not have the formatNumber and formatN *** class functions of VBs.
However, regular expressions are available almost everywhere in Js. This is my strength and attracts me. Unlike VBs, only RegExp can use regular expressions in the domain.
Ref
How to use: Create a new class that inherits from NSString, and then import the Nsstring+check.h header file by judging the string's property value (Checkphonenuminput) YES or NO.//Nsstring+check.hIcs//Created by Casystar on 15-4-2.Copyright (c) years Dong. All rights reserved.//#import @interface NSString (Check)-(BOOL) checkphonenuminput;@end//NSSTRING+CHECK.MIcs//Created by Casystar on 15-4-2.Copyright (c) years Dong. All rights reserved.//#import "Nsstring+check.h"@implementation NSString (C
In node. js, You Can format a number to add a kilobytes of characters.
Processing method separated by commas (,)
Regular Expression mode:Copy codeThe Code is as follows:"15000000 ". split (""). reverse (). join (""). replace (/(\ d {3})/g, "$1 ,"). split (""). reverse (). join ("");
"115000000". split (""). reverse (). join (""). replace (/(\ d {3 })(? = [^ $])/G, "$1,"). split (""). reverse (). join ("");
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.