如何将字符串的第一个字母设为大写,但不更改任何其他字母的大小写?
例如:
"this is a test" - > "This is a test""the Eiffel Tower" - > "The Eiffel Tower""/index.html" - > "/index.html"我有一个字符串,让我们说Hello world,我需要在索引3处替换char.如何通过指定索引来替换char?
var str = "hello world";
Run Code Online (Sandbox Code Playgroud)
我需要类似的东西
str.replaceAt(0,"h");
Run Code Online (Sandbox Code Playgroud)