System.Length 函数

function _PCharLen(P: _PAnsiChr): Longint;
{$IFNDEF LEGACY_PCHARLEN}
begin
  Result := 0;
  if P <> nil then
    while P[Result] <> #0 do
      Inc(Result);
end;

喜欢理由:简洁

如果是我写可以写成这个样子

I:=0;

while P[i] <> #0 do begin

I:=I+1;

result:=result+1;

end;

学到的内容: #号代表10进制数,与之对应的有$代表的16进制数,二进制?8进制好像没有,只能用函数HexToBin转二进制。

时间: 2024-08-05 09:33:31

System.Length 函数的相关文章

调用函数时传递的实参个数arguments.length; ,函数定义时的形参个数sum.length

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>范例6-4</title>

string 中的 length函数 和size函数 返回值问题

string 中的 length函数 和 size函数 的返回值  (  还有 char [ ] 中 测量字符串的  strlen 函数 ) 应该是 unsigned int 类型的 不可以 和 -1 比较. 应尽量避免 unsigned int 类型 和 int类型 数据 的比较 .当unsigned int 类型 和 int类型 数据 比较 时 ,会 把int 类型 转换 为 unsigned int类型 .如果 int是负数 ,转换 为 unsigned int 会是 一个 很大 的正整数

【ASP.NET】 中 system.math 函数使用

1 /* 字段 */ 2 Math.E; //2.71828182845905 3 Math.PI; //3.14159265358979 4 5 /* 静态方法 */ 6 Math.Abs; //绝对值 7 Math.Acos; //反余弦 8 Math.Asin; //反正弦 9 Math.Atan; //反正切 10 Math.Atan2; //反正切, 两参数 11 Math.BigMul; //int32 * int32 = int64 12 Math.Ceiling; //取 >=

c++ string的size()函数和length()函数

C++标准库中的string中两者的源代码如下: size_type   __CLR_OR_THIS_CALL   length()   const { //   return   length   of   sequence return   (_Mysize); } size_type   __CLR_OR_THIS_CALL   size()   const { //   return   length   of   sequence return   (_Mysize); } 所以两者没

Matlab load &amp; global 变量 &amp; length( ) 函数 &amp; msgbox( )函数

Matlab 图像处理 Day7: 1. load 变量: 作用是读取一个 .mat 文件. 2. global 变量: 意思后面声明的变量是全局变量. 3. length( ): % 一般形式为 x = length( A ): 其中A是矩阵,length( )返回的是矩阵行或列数值较大的那个 4.msgbox( ): % 根据matlab自带的帮助文档可以知道 msgbox 函数大致有5种用法,分别是: < i >.msgbox(Message): < ii >.msgbox(

Java数组的复制Arrays.copyOf()和System.arraycopy()函数

public static native void arraycopy(Object src, int srcPos, Object dest, int destPos, int length); arraycopy是个本地方法,无返回值. public static <T,U> T[] copyOf(U[] original, int newLength, Class<? extends T[]> newType) { T[] copy = ((Object)newType ==

Delphi Length函数

unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { P

C++ string的size()和length()函数没有区别

C++标准库中的string中两者的源代码如下:      size_type   __CLR_OR_THIS_CALL   length()   const     { //   return   length   of   sequence     return   (_Mysize);     }         size_type   __CLR_OR_THIS_CALL   size()   const     { //   return   length   of   sequenc

system, fileExist函数包装

#include "stdio.h" #include <string> #include<sys/types.h> #include<fcntl.h> #include <sys/stat.h> using std::string; #include <iostream> #include <map> #include <string> #include <sys/time.h> #inc