首页 > 其他分享 >从路径中拆分出文件名和后缀

从路径中拆分出文件名和后缀

时间:2022-10-14 18:07:58浏览次数:52  
标签:pure 文件名 后缀 filetype pos len filename 拆分 TYPE


"函数:拆分文件绝对路径

long_filename = l_local_file_path "文件绝对路径 C://DOC/TEST.TXT

pure_filename = l_pure_filename "文件名称(不带后缀) C://DOC/TEST
pure_extension = l_pure_extension. "文件后缀TXT

或者:

FORM getfiletype USING filename TYPE localfile filetype TYPE c.
DATA: len TYPE i,
pos TYPE i,
char TYPE c.
len = STRLEN( filename ).
pos = len.
DO len TIMES.
pos = pos - 1.
char = filename+pos(1).
IF char ='.'.
len = len - pos.
pos = pos + 1.
filetype = filename+pos(len).
TRANSLATE filetype TO UPPER CASE.
EXIT.
ENDIF.
ENDDO.
ENDFORM.


从路径中拆分出文件名和后缀_绝对路径



标签:pure,文件名,后缀,filetype,pos,len,filename,拆分,TYPE
From: https://blog.51cto.com/u_15680210/5757653

相关文章