1、【C#】创建命令行测试项目 StringLength


2、【C#】在Main中添加如下测试代码
string s = "this is test";
// 输出s的长度
Console.WriteLine("s 长度 = " + s.Length);
// 让界面停留,否则,界面会一闪而过,就看不到输出内容
Console.ReadLine();

3、【C#】测试结果如下:

4、【Java】测试字符长度如下:
String s = "this is test";
int sLength = s.length();

5、【C++】测试字符长度如下:
string s = "this is test";
int sLength = s.size();

6、【JS】测试字符长度如下:
var s = 'this is test';
s.length

7、【Sql Server】测试字符长度如下:
-- 定义临时变量
declare @s varchar(200) = 'this is test';
-- 获取长度
select len(@s);
