`
pentium100
  • 浏览: 63187 次
  • 性别: Icon_minigender_1
  • 来自: 厦门
社区版块
存档分类
最新评论

Tab character as delimiter in ABAP string

 
阅读更多
转自: http://www.kerum.pl/infodepot/00014


Tab character as delimiter in ABAP string

It can be a bit difficult to use tabulator character (hex code 0x0009) in ABAP strings. On the other hand it is often used as separator in various interface files and you need tab character to split the lines into fields or insert it into the strings as delimiter.

If you need to fulfill the unicode check, you have to use special approach to combine hex code and string. Otherwise you will get the syntax error from compiler:
"TAB" must be a character-like data object (data type C, N, D, T, or STRING)
Here three examples, how the tab character can be used in combination with string in abap. You can use similar approach for other difficult characters, for example ENTER.
Example 1: can be used in non-unicode and unicode systems: (tabulator hex code is defined in class CL_ABAP_CHAR_UTILITIES as constants HORIZONTAL_TAB)
DATA:
  tab type c value cl_abap_char_utilities=>horizontal_tab,
  str TYPE string.

CONCATENATE 'aaa' 'bbb' INTO str SEPARATED BY tab.
Here other useful constants defined in class CL_ABAP_CHAR_UTILITIES:

Name Length Hex-Value Dec-Value
BACKSPACE 1 0x08 8
HORIZONTAL_TAB 1 0x09 9
VERTICAL_TAB 1 0x0B 11
FORM_FEED 1 0x0C 12
NEWLINE 1 0x0A 10
CR_LF 2 0x0D0A 13 10
Example 2: it also works in non-unicode and unicode systems:
DATA:
  tab TYPE x VALUE '09',
  chr TYPE c,
  str TYPE string.

FIELD-SYMBOLS:
  <fs> TYPE ANY.

ASSIGN chr TO <fs> CASTING TYPE x.
<fs> = tab.

CONCATENATE 'aaa' 'bbb' INTO str SEPARATED BY chr.
Exapmle 3: it will only work in non-unicode system:
DATA:
  tab TYPE x VALUE '09',
  str TYPE string.

CONCATENATE 'aaa' 'bbb' INTO str SEPARATED BY tab.


分享到:
评论

相关推荐

    详解 Mysql中的delimiter定义及作用

    初学mysql时,可能不太明白delimiter的真正用途,delimiter在mysql很多地方出现,比如存储过程、触发器、函数等。 学过oracle的人,再来学mysql就会感到很奇怪,百思不得其解。 其实就是告诉mysql解释器,该段命令...

    StringToken

    String tokenization is defined as the problem that consists of breaking up a string into tokens which are seperated by delimiters. Both tokens and delimiters are themselves strings. Commonly used ...

    oracle 函数判断字符串是否包含图片格式的实例代码

    CREATE OR REPLACE FUNCTION fn_split (p_str IN VARCHAR2, p_delimiter IN VARCHAR2) RETURN ty_str_split IS j INT := 0; i INT := 1; len INT := 0; len1 INT := 0; str VARCHAR2 (4000); str_split ty_str...

    vb.net字符串转换

    Split Split(string1,delimiter[, count[, start]]) 将字符串根据delimiter拆分成一维数组,其中delimiter用于标识子字符串界限。如果省略,使用空格("")作为分隔符。 count 返回的子字符串数目,-1 指示返回所有子...

    CSV.rar_In Writing_as3 csv

    AS3 CSV reading/writing. Supports full CSV format included escape sequences and embedded characters. Configurable delimiter. Default is quote. Working in production code.

    unbalanced-toggle

    unbalanced-toggle

    Delimiter_Matching 检查文件中定界符匹配

    用于判断文件中(),[],/* */,是否匹配,堆栈实现

    端口查看工具

    o A tooltip is displayed when a string in a column is longer than the column length. * Version 1.09: o /close command-line parameter - Close a connection from command-line * Version 1.08: o ...

    php将字符串转换为数组实例讲解

    explode ( string $delimiter , string $string [, int $limit ] ) : array 此函数返回由字符串组成的数组,每个元素都是 string 的一个子串,它们被字符串 delimiter 作为边界点分割出来。 explode参数 delimiter:...

    Python的string模块中的Template类字符串模板用法

    可以通过继承”string.Template”, 覆盖变量delimiter(定界符)和idpattern(替换格式), 定制不同形式的模板. 代码: # -*- coding: utf-8 -*- import string template_text = ''''' Delimiter : %% Replaced : %...

    华南理工大学计算机全英班编译原理实验1

    Illegal character, that is, scanner may recognize a character that is not in the alphabet of TINY+, such as $ is an illegal character The right bracket of a STRING is lost, such as ' scanner The...

    asp字符串处理函数大全

    Split Split(string1,delimiter[,count[,start]]) 将字符串根据delimiter拆分成一维数组,其中delimiter用于标识子字符串界限。如果省略,使用空格("")作为分隔符。count返回的子字符串数目,-1指示返回所有子字符串...

    MySql中 delimiter 详解.docx

    其实就是告诉mysql解释器,该段命令是否已经结束了,mysql是否可以执行了。默认情况下,delimiter是分号;。在命令行客户端中,如果有一行命令以分号结束,那么回车后,mysql将会执行该命令。

    MySql delimiter的作用是什么

    其实就是告诉mysql解释器,该段命令是否已经结束了,mysql是否可以执行了。默认情况下,delimiter是分号;。在命令行客户端中,如果有一行命令以分号结束,那么回车后,mysql将会执行该命令。

    node.js中的path.delimiter方法使用说明

    主要介绍了node.js中的path.delimiter方法使用说明,本文介绍了path.delimiter的方法说明、语法、使用实例和实现源码,需要的朋友可以参考下

    MySQL 自定义函数CREATE FUNCTION示例

    mysql&gt; mysql&gt; delimiter $$ mysql&gt; mysql&gt; CREATE FUNCTION myFunction -&gt; (in_string VARCHAR(255), -&gt; in_find_str VARCHAR(20), -&gt; in_repl_str VARCHAR(20)) ...-&gt; SET l_find_pos=INSTR(in_string,in_find_st

    php fputcsv命令 写csv文件遇到的小问题(多维数组连接符)

    命令: fputcsv() 命令格式:int fputcsv ( resource handle [, array fields [, string delimiter [, string enclosure]]] ) 命令解析:fputcsv() 将一行(用 fields数组传递)格式化为 CSV 格式并写入由 handle...

    Delimiter Matching

    数据结构与算法第二次上机代码 利用栈来实现字符的匹配

Global site tag (gtag.js) - Google Analytics