Delphi中的WideString的WrapText [英] WrapText for WideString in Delphi
本文介绍了Delphi中的WideString的WrapText的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Delphi有一个有一个单位 TntSysUtils
,其中包括以下功能:
function WideWrapText(const Line,BreakStr:WideString; const BreakChars:TSysCharSet;
MaxCol:Integer):WideString;超载;
function WideWrapText(const Line:WideString; MaxCol:Integer):WideString;超载;
替代下载网站是 here 。
Delphi has a WrapText
function:
function WrapText(const Line, BreakStr: string; const BreakChars: TSysCharSet; MaxCol: Integer): string;
function WrapText(const Line: string; MaxCol: Integer): string;
Now i need a version that handles WideStrings:
function WrapTextW(const Line: WideString; MaxCol: Integer): WideString;
Is any such function written somewhere already?
WARNING: Not every wide string character is 2-bytes
Which is why i'm afraid to write it
Update: Example of a character that takes more than 2-bytes to represent:
Capital Latin W with ring and cedilla
- Bytes: 57 00 66 03 27 03
- Rendered in Chrome 17:
- Rendered in Internet Explorer 9:
- Rendered in Notepad using Segoe UI:
- Rendered in Notepad using Consolas:
- Rendered in your browser in sans-serif font: W̧̊
- Rendered in your browser in
monospaced
font:W̧̊
解决方案
As mentioned by kobik, TNT UnicodeControls has a unit TntSysUtils
which includes following function :
function WideWrapText(const Line, BreakStr: WideString; const BreakChars: TSysCharSet;
MaxCol: Integer): WideString; overload;
function WideWrapText(const Line: WideString; MaxCol: Integer): WideString; overload;
Alternate download site is here.
这篇关于Delphi中的WideString的WrapText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文