2012-03-14 91 views
7

德尔福有一个WrapText功能:WrapText为WideString的德尔福

function WrapText(const Line, BreakStr: string; const BreakChars: TSysCharSet; MaxCol: Integer): string; 
function WrapText(const Line: string; MaxCol: Integer): string; 

现在我需要一个处理WideStrings版本:

function WrapTextW(const Line: WideString; MaxCol: Integer): WideString; 

写入已经某处任何这样的功能呢?

警告:并不是每一个宽字符串的字符为2个字节

这就是为什么我怕写

更新:这需要超过2字符的示例-bytes表示:

资本拉丁W的环和变音符号

  • 字节:使用索拉enter image description here
  • 渲染在记事本中:57 00 66 03 27 03
  • 渲染在铬17:enter image description here
  • 在Internet Explorer 9渲染:enter image description here使用在记事本
  • 渲染濑越UI :enter image description here
  • 在浏览器中以无衬线字体呈现:W̧̊
  • 在您的浏览器中呈现在monospaced字体:W̧̊
+2

这将导致可能从Delphi 2009复制源代码作为答案。 +1反正 – TLama 2012-03-14 14:08:44

+5

@TLama:这就是为什么我把它标记为德尔福的最后一个版本,没有更好的宽带支持(让大卫离开我的后背!) – 2012-03-14 14:14:13

+4

Tnt组件套装在'TntSysUtils.pas'中有'WideWrapText' – kobik 2012-03-14 14:21:10

回答

3

正如kobik提到的,TNT UnicodeControls具有单元TntSysUtils其包括下列的函数:

function WideWrapText(const Line, BreakStr: WideString; const BreakChars: TSysCharSet; 
    MaxCol: Integer): WideString; overload; 
function WideWrapText(const Line: WideString; MaxCol: Integer): WideString; overload; 

备用下载站点是here