狠急!!多谢!!我是从TMemo控件中取出的字符串。
其中,一个汉字占两个字节,一个英文字符占一个字节,回车占两个字节。
我现在打算按要求对其重新编排,所以必须要对每一个字符是什么类型进行判断才行。请那位大虾执教!!我对字符串操作这方面也不是很熟悉,多多指教!
怎样实现才好?
其中,一个汉字占两个字节,一个英文字符占一个字节,回车占两个字节。
我现在打算按要求对其重新编排,所以必须要对每一个字符是什么类型进行判断才行。请那位大虾执教!!我对字符串操作这方面也不是很熟悉,多多指教!
怎样实现才好?
wis : WideString;
Begin
wis := WideString( ans );
End;
只是靠判断ASCII码值那就会死人地,一个汉字两个ASCII码值,我怎么知道它是英文字副还是应该组合在一起呢
我还写了个简单的函数:
function GetVolidStr(const Value: String): String;
var
ResultStr : String;
begin
if Length(Value) > 0 then
begin
if ByteType(Value, Length(Value)) = mbLeadByte then
ResultStr := Copy(Value, 1, Length(Value)-1)
else
ResultStr := Value;
end
else ResultStr := '';
Result := ResultStr;
end;
你只需在调用GetVolidStr函数时,传你可能出错的字符串即可。
http://expert.csdn.net/Expert/topic/2365/2365691.xml?temp=.1057093
http://expert.csdn.net/Expert/topic/2324/2324672.xml?temp=.884762
http://expert.csdn.net/Expert/topic/2295/2295888.xml?temp=.9960443
http://expert.csdn.net/Expert/topic/2055/2055563.xml?temp=.842251
http://expert.csdn.net/Expert/topic/2295/2295888.xml?temp=.455456
还有怎样任意读取字符串中的某一个字符?如何判断到了字符串的结尾
同意 wangl() 的。
为什么
Memo1.Text := 'asdasd' + #13#10 + 'asdasd';
没有显示换行呢?显示了两个空格???