Metric Fast Development platform There is a Len in the base function that gets the character length function. The specific usage is:
len ("123ABC string")
The result of this method is: 9
that is, the total number of characters, without distinguishing between single-byte and double-byte cases.
If a field is set to a length of 9, then this string is saved to the database, it will prompt the string is too long, because the database is generally determined by the length of bytes.
in the Metric rapid development platform, there is no direct supply of this get string byte length function. The user wants to know how many bytes the string occupies and how to get it in the platform?
we know that the metric rapid development platform is a perfect combination of C #, and if two of times developers need similar functionality in their use, then they can find answers directly from C #.
there is a static method in C # that gets the length of the string bytes. static methods of C # can be used directly in the platform.
System.Text.Encoding.Default.GetBytes (String). Length
Example:
The byte length. value= System.Text.Encoding.Default.GetBytes (Text input box 1. Value). Length
The character length. value= len (Text input box 1. Value)
650) this.width=650; "id=" aimg_1664 "src=" http://bbs.delit.cn/data/attachment/forum/201606/15/ 142013h8z7sssd4682m4xe.png.thumb.jpg "width=" 399 "height=" 129 "alt=" 142013h8z7sssd4682m4xe.png.thumb.jpg "/>
other similar:
' Get the local computer name
MsgBox(System.Environment.MachineName)
' Get local computer users
MsgBox(System.Environment.UserName)
Original address: http://bbs.delit.cn/thread-1065-1-1.html
Reprint please specify the source:
Author: metric Technology http://www.delit.cn
Get string length, character length, byte length