I accidentally thought it was the limitation of the previous Windows Control. I checked that msdn was actually restricted by C # (. NET.
" Attribute Value
Type: System..::.Int32
The number of characters that can be entered in the text box
HTML form length is calculated by the number of characters, whether it is Chinese characters or letters, but the database is also in bytes, the Chinese characters accounted for 2 letters accounted for 1, so it is easy to write the length of the
Learn about PHP. Getting strings in PHP has a strlen built-in function;Here we will share with you a more efficient way to judge the length of a string under certain circumstances;Let's take a look at the execution efficiency of the following two
Jstl:
2}">
Note: Remember to reference the tag Library
Ii. User-Defined Functions
Package com. uisk. util;/*** Define functions*/Public class ufunction {/*** Get the length of a string** @ Param Str* @ Return int*/Public static int getlen
Definition and usageTheStrlen() The length string returned by the function.It is used to calculate the character length. A Chinese character is 2 characters.SyntaxStrlen (string) ParameterDescriptionStringRequired. Specifies the string to checkLet's
I encountered a small detail problem today and found it to be a long time.
String STR = "a.2104697aa (Wuhu jinaorui) B .2104697ba (Changsha Bosch )";
Str. Length = 40
In C #, the length of string STR is 40. Here it refers to the length of string.
/* * param str to intercept the string * param L to intercept the byte length, note that the byte is not a character, a kanji two bytes * Return truncated string */function cutstr (str,l) { var result = ' ', strlen =
Tonight, when writing a form validation class for a framework, you need to determine whether a string length is within a specified range, and naturally, think of the strlen function in PHP.
The code is as follows
$str =
Copy Code code as follows:
Using System;
Using System.Text;
Namespace Stringlengthtest
{
Class Program
{
static void Main (string[] args)
{
String strtmp = "abcd1234 package";
int i = encoding.getencoding ("GB2312"). GetBytes (strtmp).
function Gottopic (Str,strlen)
If str= "" Then
Gottopic= ""
Exit function
End If
Dim l,t,c, I
Str=replace (replace (replace (str, , ""), """, CHR), ">", ">"), "L=len (str)
T=0
For I=1 to L
C=abs (ASC (str,i,1))
If c>255 Then
T=t+2
Else
T=t+1
JS strings are string objects, you can use the length property of a string object to get their lengths, but whether it is Chinese, full-width symbols, and the English minimum length unit is 1, this is not the same as PHP's strlen ().
Copy
/****************************************************************//* Name: datalength//* function: Calculate the length of the data//* entry parameters: FData: Need Calculated data//* exit Parameters: Returns the length of the Fdata (Unicode length
** Handle too long string, intercept and add ellipsis* Note: Half angle length is 1, full angle length is 2** PSTR: string* PLen: Intercept length** Return: After the intercepted string*
Copy Code code as follows:
function
The official address of the plugin
http://remysharp.com/2008/06/30/maxlength-plugin/
The call is simple:
The remaining words:
But it's a lot of trouble to write, and the most painful thing is to verify that the
Example uses the length function
The code is as follows
Copy Code
The results of the above code output are: 19
Chinese occupies two characters
code is as follows
copy code
//
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
XX Author: ZHS (Cultural man)
XX Contact information: 982376496@qq.com (Contact please specify CSDN)
XX Copyright Notice: Original article, Welcome to comment and
Today specifically searched the database of the string definition of the difference, write good, special excerpt as follows:
In the database, the character type of data is the most, can account for more than 80% of the entire database. It is very
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.