📄 mf_strlen.hlp
字号:
{smcl}
{* 28mar2005}{...}
{cmd:help mata strlen()}
{hline}
{* index strlen()}{...}
{* index length}{...}
{title:Title}
{p 4 4 2}
{bf:[M-5] strlen() -- Length of string}
{title:Syntax}
{p 8 12 2}
{it:real matrix} {cmd:strlen(}{it:string matrix s}{cmd:)}
{title:Description}
{p 4 4 2}
{cmd:strlen(}{it:s}{cmd:)} returns the length of -- the number of characters
contained in -- the string {it:s}.
{p 4 4 2}
When {it:s} is not a scalar, {cmd:strlen()} returns element-by-element
results.
{title:Remarks}
{p 4 4 2}
Stata understands {cmd:strlen()} as a synonym for its own {cmd:length()}
function, so you can use the function named {cmd:strlen()} in both your Stata
and Mata code. Do not, however, use {cmd:length()} in Mata when you
mean {cmd:strlen()}. Mata's {cmd:length()} function returns the
length (number of elements) of a vector.
{title:Conformability}
{cmd:strlen(}{it:s}{cmd:)}:
{it:s}: {it:r x c}
{it:result}: {it:r x c}
{title:Diagnostics}
{p 4 4 2}
{cmd:strlen(}{it:s}{cmd:)}, when {it:s} is a binary string (a string
containing binary 0), returns the overall length of the string, not the
location of the binary 0. Use {cmd:strpos(}{it:s}{cmd:, char(0))} if you want
the location of the binary 0.
{title:Source code}
{p 4 4 2}
Function is built-in.
{title:Also see}
{p 4 13 2}
Manual: {hi:[M-5] strlen()}
{p 4 13 2}
Online: help for
{bf:{help mf_strpos:[M-5] strpos()}};
{bf:{help m4_string:[M-4] string}}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -