全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:770
推到 Plurk!
推到 Facebook!

請問字串陣列可存放的大小為多少???可增加嗎??

尚未結案
kelvincoby
一般會員


發表:6
回覆:4
積分:2
註冊:2004-08-28

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-09-08 15:08:12 IP:140.118.xxx.xxx 未訂閱
請問各位前輩 小弟宣告一個String test[1000]去放字串,我在每個element(如test[1])中 放了很大量的資料,但總是好像有些資料放不進去,想請問一下是否是該element 中本身的限制,如果是,該如何宣告每個element中的大小???謝謝
nlj859
資深會員


發表:139
回覆:375
積分:322
註冊:2004-03-20

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-09-08 15:46:42 IP:163.28.xxx.xxx 未訂閱
Hello kelvincoby, 不曉得你的資料是多大的資料?是什麼樣的資料? 另外,可否再附上一些資訊? 或是把整個project傳到會員檔案求助區看看. 謝謝. 發表人 - nlj859 於 2004/09/08 19:14:16
kelvincoby
一般會員


發表:6
回覆:4
積分:2
註冊:2004-08-28

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-09-08 16:25:09 IP:140.118.xxx.xxx 未訂閱
不好意思,可能我不太會表達, 裡面放的就是很長的字(String),在每個x[i]中都有放!!
kelvincoby
一般會員


發表:6
回覆:4
積分:2
註冊:2004-08-28

發送簡訊給我
#4 引用回覆 回覆 發表時間:2004-09-08 16:45:11 IP:140.118.xxx.xxx 未訂閱
我再說明一下: 就是有些資料的末端都不見了,所以我覺得是不是資料太長所以放不進去 的關係???
folkchen
高階會員


發表:9
回覆:232
積分:173
註冊:2003-10-09

發送簡訊給我
#5 引用回覆 回覆 發表時間:2004-09-09 08:50:27 IP:211.20.xxx.xxx 未訂閱
請參考 BCB 中的說明檔 String types A string represents a sequence of characters. Object Pascal supports the following predefined string types. Type Maximum length Memory required Used for ShortString 255 characters 2 to 256 bytes backward compatibility AnsiString ~2^31 characters 4 bytes to 2GB 8-bit (ANSI) characters WideString ~2^30 characters 4 bytes to 2GB Unicode characters; AnsiString, sometimes called the long string, is the preferred type for most purposes. String types can be mixed in assignments and expressions; the compiler automatically performs required conversions. But strings passed by reference to a function or procedure (as var and out parameters) must be of the appropriate type. Strings can be explicitly cast to a different string type (see Typecasts). The reserved word string functions like a generic type identifier. For example, var S: string; creates a variable S that holds a string. In the default {$H } state, the compiler interprets string (when it appears without a bracketed number after it) as AnsiString. Use the {$H? directive to turn string into ShortString. The standard function Length returns the number of characters in a string. The SetLength procedure adjusts the length of a string. Comparison of strings is defined by the ordering of the characters in corresponding positions. Between strings of unequal length, each character in the longer string without a corresponding character in the shorter string takes on a greater-than value. For example, ?B?is greater than ?? that is, 'AB' > 'A' returns True. Zero-length strings hold the lowest values. You can index a string variable just as you would an array. If S is a string variable and i an integer expression, S[i] represents the ith character?r, strictly speaking, the ith byte?n S. For a ShortString or AnsiString, S[i] is of type AnsiChar; for a WideString, S[i] is of type WideChar. The statement MyString[2] := 'A'; assigns the value A to the second character of MyString. The following code uses the standard UpCase function to convert MyString to uppercase. 發表人 - folkchen 於 2004/09/09 09:01:54
系統時間:2024-03-28 16:47:27
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!