📄 _getfilename.hlp
字号:
{smcl}
{* 10mar2005}{...}
{cmd:help _getfilename}, {cmd:help _shortenpath}{...}
{right:also see: {help undocumented}}
{hline}
{title:Title}
{p 4 22 2}
{cmd:_getfilename} {hline 2} Utility commands for handling path-filename
specifications
{title:Syntax}
{p 8 8 2}{cmd:_getfilename} {cmd:`"}{it:path-filename}{cmd:"'}
{p 8 8 2}{cmd:_shortenpath} {cmd:`"}{it:path-filename}{cmd:"'}{cmd:,}
{cmd:len(}{it:#}{cmd:)} [ {cmd:head(}{it:str}{cmd:)} ]
{title:Description}
{pstd}{cmd:_getfilename} returns in {cmd:r(filename)} the name of
the file (with extension), stripping off drive and directory
information. Also see {helpb findfile} for a related command.
{pstd}{cmd:_shortenpath} returns in {cmd:r(pfilename)} a shortened
path-filename string of length at most {cmd:len}. Shortening is
accomplished by replacing leading directories by a single {cmd:*},
denoting `some string'. {cmd:_shortenpath} never shortens the
filename itself, and leading directories are represented by a string
at least as long as {cmd:*\}, so {cmd:_shortenpath} may actually
return a string longer than {cmd:len}.
{title:Options}
{phang}{cmd:len(}{it:#}{cmd:)} ({cmd:_shortenpath} only)
is not optional. It specifies the length to which the {it:path-filename}
should be shortened.
{phang}{cmd:head(}{it:#}{cmd:)} ({cmd:_shortenpath} only)
specifies the string used to represent the leading directories removed
from the head of {it:path-filename}. It defaults to {cmd:*}.
{title:Examples}
{phang}{cmd:. _getfilename c:\archive\stata\data\hin95.dta}{break}
{txt:r(filename):} {res:hin95.dta}
{phang}{cmd:. _shortenpath c:\archive\stata\data\hin95.dta, len(20)}{break}
{txt:r(pfilename):} {res:*\data\hin95.dta}
{phang}{cmd:. _shortenpath c:\archive\stata\data\hin95.dta, len(5)}{break}
{txt:r(pfilename):} {res:*\hin95.dta}
{title:Acknowledgment}
{pstd}These utilities were written by Jeroen Weesie, Dept of Sociology,
Utrecht University, the Netherlands.
{title:Also see}
{psee}
Online: {helpb dir}, {helpb findfile}, {helpb macro}, {helpb sysdir}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -