小编A.F*_*zen的帖子

How to use tolower in D

I want to to put the first letter of a string into lowercase in D.

As a string is imutable in D, there doesn't seem to be a simple way.

I came up with this:

string mystr = "BookRef";
string outval = toLower( mystr[0..1] ) ~ mystr[1..$]; 
writeln( "my outval: ", outval );
Run Code Online (Sandbox Code Playgroud)

Is there an easier way ?

d phobos

2
推荐指数
1
解决办法
59
查看次数

标签 统计

d ×1

phobos ×1