楼主: ryuuzt
6219 12

[原创博文] 求助:去掉汉字间的空格 [推广有奖]

11
zhentao 发表于 2012-9-15 14:56:37
bobguy 发表于 2012-9-14 10:42
First, you can use the substr function to find out what is its value for that space-like character ...
I found a sample code at http://support.sas.com/kb/24/716.html

data sample;
  string='Your'||'05'x||'data'||'0D'x||'goes'||'0C'x||'here.'||'0A'x;
run;

data _null_;
  set sample;
  put string=;

  /* Verify each byte in string until no more non-printables are found */
  do until(test=0);

    /* For SAS 9.0 and above, NOTPRINT */
    test=notprint(string);

    /* prior to SAS 9.0, use VERIFY */
    *test=verify(upcase(string),' ABCDEFGHIJKLMNOPQRSTUVWXYZ,.1234567890');

    /* If a non-printable is found...replace it with a space */
    if test>0 then do;
      substr(string,test,1)=' ';
      end;
    end;
  put string=;
run;

12
cufering 发表于 2012-9-16 11:58:47
楼主说的空格可能只是看起来像空格,其实这个空格的编码和普通的空格是不一样的,可用UE工具查看下

13
ryuuzt 发表于 2012-9-17 09:18:27
cufering 发表于 2012-9-16 11:58
楼主说的空格可能只是看起来像空格,其实这个空格的编码和普通的空格是不一样的,可用UE工具查看下
好的,我试试。
同时感谢楼上的各位。

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-29 03:10